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

Psth tests #347

Merged
merged 21 commits into from
Sep 12, 2022
Merged

Psth tests #347

merged 21 commits into from
Sep 12, 2022

Conversation

tensionhead
Copy link
Contributor

@tensionhead tensionhead commented Sep 6, 2022

PSTH tests and Selector.trials addition

  • new obj.selection.trials to access the (pruned by the selection) trials directly
  • new obj.trialintervals and obj.selection.trialintervals to see relevant time interval of trials in seconds
  • as usual, the real performance of our psth will only come to light when ppl use it
  • @kshapcott and/or @atlaie feel free to blast in some (real) data 😉

addresses #175

Author Guidelines

  • Is the change set < 600 lines?
  • Was the code checked for memory leaks/performance bottlenecks?
  • Is the code running locally and on the ESI cluster?
  • Is the code running on all supported platforms?

Reviewer Checklist

  • Are testing routines present?
  • Do parallel loops have a set length and correct termination conditions?
  • Do objects in the global package namespace perform proper parsing of their input?
  • Do code-blocks provide novel functionality, i.e., no re-factoring using builtin/external packages possible?
  • Code layout
    • Is the code PEP8 compliant?
    • Does the code adhere to agreed-upon naming conventions?
    • Are keywords clearly named and easy to understand?
    • No commented-out code?
  • Are all docstrings complete and accurate?
  • Is the CHANGELOG.md up to date?

- proportion makes troubles because of potentially empty (all 0s)
time-histograms

Changes to be committed:
	modified:   syncopy/spikes/compRoutines.py
	modified:   syncopy/spikes/psth.py
	modified:   syncopy/spikes/spike_psth.py
	modified:   syncopy/tests/test_spike_psth.py
- normalization by np.histogram2d is done in, well, 2d
- we need for output='proportion' normalized 1d histograms
- fixed the case of 0 events

Changes to be committed:
	modified:   syncopy/spikes/psth.py
- it's maybe now too intricate, on the other hand hopefully also more
more realistic

Changes to be committed:
	modified:   syncopy/tests/synth_data.py
Changes to be committed:
	modified:   syncopy/tests/synth_data.py
Changes to be committed:
	modified:   syncopy/spikes/spike_psth.py
	modified:   syncopy/tests/test_spike_psth.py
- for various applications (psth time window/toi selections) it is good to
know/see what are the relative start and end times of each trial

Changes to be committed:
	modified:   syncopy/datatype/base_data.py
	modified:   syncopy/datatype/continuous_data.py
	modified:   syncopy/spikes/spike_psth.py
- poisson_noise now again has integer offsets
- we might need a global time-offset parameter to accomodate bin positions

Changes to be committed:
	modified:   syncopy/spikes/compRoutines.py
	modified:   syncopy/tests/synth_data.py
	modified:   syncopy/tests/test_spike_psth.py
- added latency tests

Changes to be committed:
	modified:   syncopy/spikes/compRoutines.py
	modified:   syncopy/spikes/spike_psth.py
	modified:   syncopy/tests/test_spike_psth.py
- got now almost everything, however the channel/unit mapping still
has problems

Changes to be committed:
	modified:   syncopy/spikes/psth.py
	modified:   syncopy/spikes/spike_psth.py
	modified:   syncopy/tests/test_spike_psth.py
- chan/unit mapping is fine.. however we still need to fully respect
channel/unit selections

Changes to be committed:
	modified:   syncopy/spikes/compRoutines.py
	modified:   syncopy/tests/test_spike_psth.py
- preparation for plugging an Indexer into Selector.trials
- might be a good idea to also have a `trial_ids` property in base_data actually
- addresses #175
- let's see of that really were the last ones..

Changes to be committed:
	modified:   syncopy/datatype/base_data.py
Changes to be committed:
	modified:   syncopy/tests/test_computationalroutine.py
Changes to be committed:
	modified:   syncopy/tests/test_computationalroutine.py
	modified:   syncopy/tests/test_continuousdata.py
	modified:   syncopy/tests/test_discretedata.py
	modified:   syncopy/tests/test_specest.py
Changes to be committed:
	modified:   syncopy/shared/computational_routine.py
Changes to be committed:
	modified:   syncopy/tests/test_specest.py
@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

Merging #347 (6d78492) into dev (cc880e6) will increase coverage by 0.93%.
The diff coverage is 85.48%.

@@            Coverage Diff             @@
##              dev     #347      +/-   ##
==========================================
+ Coverage   68.87%   69.80%   +0.93%     
==========================================
  Files          77       77              
  Lines        8870     8946      +76     
  Branches     1823     1844      +21     
==========================================
+ Hits         6109     6245     +136     
+ Misses       2335     2282      -53     
+ Partials      426      419       -7     
Impacted Files Coverage Δ
syncopy/spikes/compRoutines.py 90.00% <50.00%> (+0.52%) ⬆️
syncopy/spikes/psth.py 78.57% <68.42%> (+4.49%) ⬆️
syncopy/datatype/base_data.py 82.46% <85.45%> (+0.30%) ⬆️
syncopy/spikes/spike_psth.py 79.23% <93.75%> (+35.86%) ⬆️
syncopy/datatype/continuous_data.py 83.64% <100.00%> (+0.26%) ⬆️
syncopy/datatype/discrete_data.py 83.70% <100.00%> (ø)
syncopy/datatype/methods/arithmetic.py 71.27% <100.00%> (ø)
syncopy/datatype/methods/padding.py 70.38% <100.00%> (ø)
syncopy/datatype/methods/selectdata.py 78.75% <100.00%> (ø)
syncopy/datatype/methods/show.py 80.70% <100.00%> (ø)
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

- with a closure and _preview_trial it seems to work as intended!

Changes to be committed:
	modified:   syncopy/datatype/base_data.py
	modified:   syncopy/tests/test_spike_psth.py
- Indexer indices are relative to the selected trials
- not sure if the Indexer itself works as really expected
- addresses #175

Changes to be committed:
	modified:   syncopy/datatype/base_data.py
Changes to be committed:
	modified:   syncopy/tests/test_spike_psth.py
- finally finished

Changes to be committed:
	modified:   syncopy/spikes/spike_psth.py
	modified:   syncopy/tests/test_spike_psth.py
- selection slices have to be ordered apparently, min < max

Changes to be committed:
	modified:   syncopy/datatype/base_data.py
	modified:   syncopy/tests/test_selectdata.py
@tensionhead tensionhead marked this pull request as ready for review September 6, 2022 16:55
@dfsp-spirit dfsp-spirit self-assigned this Sep 7, 2022
@@ -155,6 +158,21 @@ def spike_psth(data,
# explicit time window in seconds
else:
array_parser(latency, lims=[-np.inf, np.inf], dims=(2,))
# check that at least some events are covered
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more sanity checks are always nice

@dfsp-spirit dfsp-spirit merged commit a16b4d5 into dev Sep 12, 2022
@tensionhead tensionhead deleted the psth_tests branch September 12, 2022 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants