Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] error in get_half_of_the_data() #239

Open
HDClark94 opened this issue Mar 31, 2020 · 3 comments
Open

[BUG] error in get_half_of_the_data() #239

HDClark94 opened this issue Mar 31, 2020 · 3 comments
Assignees
Labels

Comments

@HDClark94
Copy link
Collaborator

The bug:

within PostSorting,
within compare_first_and_second_half.py,
within get_half_of_the_data_cell(prm, spike_data_in, synced_spatial_data_in, half='first_half'):

spike_data_half = None
end_of_first_half_seconds = (synced_spatial_data.synced_time.max() - synced_spatial_data.synced_time.min()) / 2
end_of_first_half_ephys_sampling_points = end_of_first_half_seconds * prm.get_sampling_rate()

line 2 looks to calculate the midpoint of the recording in seconds however instead computes half the range. for example:

min=2 seconds
max=5 seconds
then end_of_first_half_seconds should be 3.5

using the above equation
end_of_first_half_seconds = 1.5
this is less that the minimum time and therefore not possible, a fix I've implemented on my dual sorting branch uses

spike_data_half = None
end_of_first_half_seconds = (synced_spatial_data.synced_time.max() + synced_spatial_data.synced_time.min()) / 2
end_of_first_half_ephys_sampling_points = end_of_first_half_seconds * prm.get_sampling_rate()

swapping the minus for a plus changes the computation to taking the midpoint of max and min.

Could someone please check to confirm my interpretation on this?

Running environment

  • dual_sorting branch
  • Eleanor instance
@klaragerlei
Copy link
Collaborator

@HDClark94 I think I only used this where min was 0 and didn't notice, sorry.

I think your interpretation is correct, (but maybe wait for one more person to check).

@4iar
Copy link
Collaborator

4iar commented Apr 1, 2020

@HDClark94 I think this makes sense - nice find!

The function get_half_of_the_data() also uses the same calculation (here), would that need changing too?

@klaragerlei
Copy link
Collaborator

@HDClark94 this is fixed now, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants