Skip to content

Commit

Permalink
Removing useless update of asig name (gives error when name not defin…
Browse files Browse the repository at this point in the history
…ed) (#67)

* Removing useless update of asig name (gives error when name not defined)

* Handling same bug also in spatial_downsampling block
  • Loading branch information
cosimolupo committed May 22, 2024
1 parent a1c0579 commit 13ebed9
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def plot_frame(frame):

new_asig = asig.duplicate_with_new_data(signal)
new_asig.array_annotations = asig.array_annotations
new_asig.name += ""
new_asig.description += "The mean of each channel was subtracted ({})."\
.format(os.path.basename(__file__))
block.segments[0].analogsignals[0] = new_asig
Expand Down
1 change: 0 additions & 1 deletion cobrawap/pipeline/stage02_processing/scripts/detrending.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def plot_detrend(asig, detrend_asig, channel):
args.img_name.replace('_channel0', f'_channel{channel}'))
save_plot(output_path)

detrend_asig.name += ""
detrend_asig.description += "Detrended by order {} ({}). "\
.format(args.order, os.path.basename(__file__))
block.segments[0].analogsignals[0] = detrend_asig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
lowpass_frequency=args.lowpass_frequency*pq.Hz,
filter_order=args.order)

asig.name += ""
asig.description += "Frequency filtered with [{}, {}]Hz order {} "\
.format(args.highpass_frequency,
args.lowpass_frequency,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def plot_logMUA_estimation(asig, logMUA_asig, highpass_frequency, lowpass_freque
/ args.img_name.replace('_channel0', f'_channel{channel}')
save_plot(output_path)

asig.name += ""
asig.description += "Estimated logMUA signal [{}, {}] Hz ({}). "\
.format(args.highpass_frequency, args.lowpass_frequency,
os.path.basename(__file__))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def normalize(asig, normalize_by):

asig = normalize(block.segments[0].analogsignals[0], args.normalize_by)

asig.name += ""
asig.description += "Normalized by {} ({})."\
.format(args.normalize_by, os.path.basename(__file__))
block.segments[0].analogsignals[0] = asig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
asig = asig.duplicate_with_new_data(phase)
asig.array_annotations = block.segments[0].analogsignals[0].array_annotations

asig.name += ""
asig.description += "Phase signal ({}). "\
.format(os.path.basename(__file__))
block.segments[0].analogsignals[0] = asig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def plot_roi(img, contour):
new_asig = imagesequence_to_analogsignal(tmp_imgseq)

# save data and figure
new_asig.name += ""
new_asig.description += "Border regions with mean intensity below "\
+ "{args.intensity_threshold} were discarded. "\
+ "({})".format(os.path.basename(__file__))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def spatial_smoothing(imgseq, macro_pixel_dim):

imgseq_reduced.annotations.update(imgseq.annotations)

imgseq_reduced.name = imgseq.name + " "
if imgseq.name:
imgseq_reduced.name = imgseq.name
imgseq_reduced.annotations.update(macro_pixel_dim=macro_pixel_dim)
imgseq_reduced.description = imgseq.description + \
"spatially downsampled ({}).".format(os.path.basename(__file__))
Expand All @@ -56,7 +57,7 @@ def plot_downsampled_image(image, output_path):

if __name__ == '__main__':
args, unknown = CLI.parse_known_args()

block = load_neo(args.data)
asig = block.segments[0].analogsignals[0]
imgseq = analogsignal_to_imagesequence(asig)
Expand Down

0 comments on commit 13ebed9

Please sign in to comment.