Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 15, 2025
1 parent 070e33f commit 9cf6f1f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
1 change: 0 additions & 1 deletion playing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
proc_rec = correct_motion(rec)

rec.set_probe(rec.get_probe())

Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def get_activity_histogram(

return activity_histogram, temporal_bin_centers, spatial_bin_centers


def get_bin_centers(bin_edges):
return (bin_edges[1:] + bin_edges[:-1]) / 2

Expand Down Expand Up @@ -312,6 +313,7 @@ def compute_histogram_crosscorrelation(
mode="full",
)
import os

if "hello_world" in os.environ:
plt.plot(windowed_histogram_i)
plt.plot(windowed_histogram_j)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ def get_interpolate_motion_kwargs():
see that class for parameter descriptions.
"""
return {
"border_mode": "force_zeros", # fixed as this until can figure out probe
"border_mode": "force_zeros", # fixed as this until can figure out probe
"spatial_interpolation_method": "kriging",
"sigma_um": 20.0,
"p": 2
"p": 2,
}


###############################################################################
# Public Entry Level Functions
###############################################################################
Expand Down Expand Up @@ -222,7 +223,12 @@ def align_sessions(

# Ensure list lengths match and all channel locations are the same across recordings.
_check_align_sessions_inputs(
recordings_list, peaks_list, peak_locations_list, alignment_order, estimate_histogram_kwargs, interpolate_motion_kwargs
recordings_list,
peaks_list,
peak_locations_list,
alignment_order,
estimate_histogram_kwargs,
interpolate_motion_kwargs,
)

print("Computing a single activity histogram from each session...")
Expand Down Expand Up @@ -553,7 +559,9 @@ def _get_single_session_activity_histogram(
)

# It is important that the passed histogram is scaled to firing rate in Hz
scaled_hist = one_bin_histogram / recording.get_duration() # TODO: why is this done here when have a scale_to_hz arg??!?
scaled_hist = (
one_bin_histogram / recording.get_duration()
) # TODO: why is this done here when have a scale_to_hz arg??!?
chunked_bin_size_s = alignment_utils.estimate_chunk_size(scaled_hist)
chunked_bin_size_s = np.min([chunked_bin_size_s, recording.get_duration()])

Expand Down Expand Up @@ -656,9 +664,11 @@ def _create_motion_recordings(
motion,
interpolation_time_bin_centers_s=motion.temporal_bins_s,
interpolation_time_bin_edges_s=[np.array(recording.get_times()[0], recording.get_times()[-1])],
**interpolate_motion_kwargs
**interpolate_motion_kwargs,
)
corrected_recording = corrected_recording.set_probe(recording.get_probe()) # TODO: if this works, might need to do above
corrected_recording = corrected_recording.set_probe(
recording.get_probe()
) # TODO: if this works, might need to do above

corrected_recordings_list.append(corrected_recording)

Expand Down Expand Up @@ -968,7 +978,6 @@ def _check_align_sessions_inputs(
"performed using the same probe."
)


accepted_hist_methods = [
"entire_session",
"chunked_mean",
Expand Down Expand Up @@ -998,4 +1007,6 @@ def _check_align_sessions_inputs(
if ses_num == 0:
raise ValueError("`alignment_order` required the session number, not session index.")

assert interpolate_motion_kwargs["border_mode"] == "force_zeros", "InterpolateMotionRecording must be `force_zeros` until probe is figured out." # TODO: ask sam
assert (
interpolate_motion_kwargs["border_mode"] == "force_zeros"
), "InterpolateMotionRecording must be `force_zeros` until probe is figured out." # TODO: ask sam
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,13 @@ def __init__(
interpolation_time_bin_centers_s = motion.temporal_bins_s
interpolation_time_bin_edges_s = motion.temporal_bin_edges_s
else:
interpolation_time_bin_centers_s, interpolation_time_bin_edges_s = ensure_time_bins( # TODO: something is very wrong here with the typing
interpolation_time_bin_centers_s, interpolation_time_bin_edges_s
interpolation_time_bin_centers_s, interpolation_time_bin_edges_s = (
ensure_time_bins( # TODO: something is very wrong here with the typing
interpolation_time_bin_centers_s, interpolation_time_bin_edges_s
)
)

assert len(recording._recording_segments) == 1, "multi segment not supported" #??
assert len(recording._recording_segments) == 1, "multi segment not supported" # ??

for segment_index, parent_segment in enumerate(recording._recording_segments):
# finish the per-segment part of the time bin logic
Expand All @@ -405,8 +407,8 @@ def __init__(
)
assert segment_interpolation_time_bin_edges_s.shape == (segment_interpolation_time_bins_s.shape[0] + 1,)
else:
segment_interpolation_time_bins_s = interpolation_time_bin_centers_s # [segment_index]
segment_interpolation_time_bin_edges_s = interpolation_time_bin_edges_s # [segment_index]
segment_interpolation_time_bins_s = interpolation_time_bin_centers_s # [segment_index]
segment_interpolation_time_bin_edges_s = interpolation_time_bin_edges_s # [segment_index]

rec_segment = InterpolateMotionRecordingSegment(
parent_segment,
Expand Down

0 comments on commit 9cf6f1f

Please sign in to comment.