Skip to content

Commit

Permalink
working on some code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scfleming committed Jan 15, 2025
1 parent 1d48eed commit de4b53a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions astronify/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ def write(self, filepath):


class SeriesPreviews():
""" Previews (or snapshots) of 1d spectra by binning the data into
"""
Previews (or snapshots) of 1d spectra by binning the data into
five equal pieces by assigning a sound to each piece.
"""

Expand Down Expand Up @@ -359,7 +360,9 @@ def area_of_pieces(self, ydata_bins, xdata_bins):

def plot_preview(self, xdata_bin_ranges):

plt.plot(self._soniseries.data[self._soniseries.time_col], self._soniseries.data[self._soniseries.val_col], color='k')
plt.plot(self._soniseries.data[self._soniseries.time_col],
self._soniseries.data[self._soniseries.val_col],
color='k')

plt.axvspan(xdata_bin_ranges[0][0], xdata_bin_ranges[0][1], color='royalblue', alpha=0.5, lw=0)
plt.axvspan(xdata_bin_ranges[1][0], xdata_bin_ranges[1][1], color='green', alpha=0.5, lw=0)
Expand Down Expand Up @@ -403,7 +406,6 @@ def sonify_preview(self, plotting=True, verbose=False):
# Calculate standard deviation error and add to the list.
_, _, _, _, std_err = stats.linregress(xdata_bin, ydata_bin)
std_vals.append(std_err)
#std_vals.append(np.std(ydata_bin))

# Plot the spectra and ranges if in troubleshooting mode
if plotting:
Expand Down Expand Up @@ -434,14 +436,14 @@ def sonify_preview(self, plotting=True, verbose=False):

# Constraint added to keep tremolo values at or below 15, otherwise oscillations are
# more difficult to hear
#self.tremolo_vals[self.tremolo_vals > 15] = 15
# self.tremolo_vals[self.tremolo_vals > 15] = 15

if verbose:
print('Total Expected area = {0:0f}'.format(total_area))
print(' ')
print('Area Values = ', np.asarray(area_vals))
print(' ')
#print('Total Calculated area = {0:0f}'.format(np.sum(str(area_vals).split(' '))))
# print('Total Calculated area = {0:0f}'.format(np.sum(str(area_vals).split(' '))))
print(' ')
print('Amplitudes = ', self.amplitudes)
print(' ')
Expand Down Expand Up @@ -499,6 +501,6 @@ def play_preview(self):
if self._soniseries.preview_type == "ensemble":
self.stream6 = pyo.Sine(freq=[self.pitch_values[0], self.pitch_values[0]], mul=lfo1).out(delay=10, dur=4)
self.stream7 = pyo.Sine(freq=[self.pitch_values[1], self.pitch_values[1]], mul=lfo2).out(delay=10, dur=4)
self.stream8 = pyo.Sine(freq=[self.pitch_values[2], self.pitch_values[2]],mul=lfo3).out(delay=10, dur=4)
self.stream9 = pyo.Sine(freq=[self.pitch_values[3], self.pitch_values[3]],mul=lfo4).out(delay=10, dur=4)
self.stream10 = pyo.Sine(freq=[self.pitch_values[4], self.pitch_values[4]],mul=lfo5).out(delay=10, dur=4)
self.stream8 = pyo.Sine(freq=[self.pitch_values[2], self.pitch_values[2]], mul=lfo3).out(delay=10, dur=4)
self.stream9 = pyo.Sine(freq=[self.pitch_values[3], self.pitch_values[3]], mul=lfo4).out(delay=10, dur=4)
self.stream10 = pyo.Sine(freq=[self.pitch_values[4], self.pitch_values[4]], mul=lfo5).out(delay=10, dur=4)

0 comments on commit de4b53a

Please sign in to comment.