Skip to content

Conversation

@Matyasz
Copy link
Contributor

@Matyasz Matyasz commented Oct 16, 2020

Overview:

LIMS has been experiencing a number of failures over the past two days related to a small bug. Apparently, during a refactor, a particular warning got carried over, but not the action that it warned about. Doug has added full context to this in a comment on the GitHub issue.

Addresses:

Addresses issue #1755

Type of Fix:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing
    functionality to not work as expected)
  • Documentation Change

Solution:

Just trimming off the last entry of a list. Doug responded to the issue with some context, "Camstim has long had an issue where it generates one extra encoder reading at the end." Apparently this happens every time with mesoscope.

Changes:

Validation:

Screenshots:

Unit Tests:

Script to reproduce error and fix:

Configuration details:

Checklist

  • My code follows
    Allen Institute Contribution Guidelines
  • My code is unit tested and does not decrease test coverage
  • I have performed a self review of my own code
  • My code is well-documented, and the docstrings conform to
    Numpy Standards
  • I have updated the documentation of the repository where
    appropriate
  • The header on my commit includes the issue number
  • My Pull Request has the latest AllenSDK release candidate branch
    rc/x.y.z as its merge target
  • My code passes all AllenSDK tests

@njmei
Copy link
Contributor

njmei commented Oct 16, 2020

@Matyasz Can we add a regression test for the case where v_in is 1 element longer than time?

@codecov-io
Copy link

codecov-io commented Oct 16, 2020

Codecov Report

Merging #1758 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1758   +/-   ##
=======================================
  Coverage   36.16%   36.16%           
=======================================
  Files         346      346           
  Lines       33817    33819    +2     
=======================================
+ Hits        12229    12232    +3     
+ Misses      21588    21587    -1     
Impacted Files Coverage Δ
allensdk/__init__.py 68.96% <100.00%> (ø)
...k/brain_observatory/behavior/running_processing.py 96.33% <100.00%> (+1.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18f49c7...acc0738. Read the comment docs.

@wbwakeman wbwakeman added the braintv relates to Insitute BrainTV program label Oct 16, 2020
@kschelonka
Copy link
Contributor

kschelonka commented Oct 16, 2020

Let's add a test case for this. Test that 1. warning was raised and 2. data properly truncated

Especially since this came from accidentally leaving out the truncation in the first place :)

edit: didn't see Nick's request. Yes please add a unit test but also use the pytest warning capture as well

def test_get_running_df_one_fewer_timestamp_check_warning(running_data,
timestamps,
lowpass):
with pytest.warns(UserWarning):
Copy link
Contributor

Choose a reason for hiding this comment

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

For this, I would do:

with pytest.warns(UserWarning) as w:

And then test that the captured warning msg string starts with: "Time array is 1 value shorter than encoder array."


assert len(output) == 4
# Check that the output is actually trimmed
assert len(output) == len(timestamps) - 1
Copy link
Contributor

@njmei njmei Oct 19, 2020

Choose a reason for hiding this comment

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

I would add the following asserts:

assert output["v_sig"] == running_data["items"]["behavior"]["encoders"]["vsig"][:-1]
assert output["v_in"] == running_data["items"]["behavior"]["encoders"]["vin"][:-1]

Which checks that encoder values are truncated AND have the expected values.

njmei
njmei previously approved these changes Oct 20, 2020
Copy link
Contributor

@njmei njmei left a comment

Choose a reason for hiding this comment

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

LGTM

…r timestamp than encoder. Updated tests for this method to nsure that the correct warning is presented in this case, and that it returns a trimmed dataset.
@Matyasz Matyasz merged commit c46f6b3 into master Oct 20, 2020
@djkapner djkapner deleted the rc/2.3.2 branch January 4, 2021 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

braintv relates to Insitute BrainTV program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One fewer timestamp than number of angular changes when calculating angular speed

6 participants