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

add option to use a custom html field generation method #1038

Merged
merged 6 commits into from
Feb 9, 2024

Conversation

stephprince
Copy link
Contributor

@stephprince stephprince commented Jan 24, 2024

Motivation

Fix #1010 with accompanying changes in pynwb (see related PR NeurodataWithoutBorders/pynwb#1831).

These changes will check whether a value has a _generate_field_html method and use that method if it is an option when generating html representations.

How to test the behavior?

See below for an example from the related issue in which timestamps are linked across multiple spatial series.

from pynwb import NWBHDF5IO
from pynwb.testing.mock.file import mock_NWBFile
from pynwb.testing.mock.behavior import mock_SpatialSeries, mock_Position
import numpy as np

nwbfile = mock_NWBFile()

test_timestamps = np.zeros((1000,))
test_data = np.random.rand(*(1000, 3))
spatial_series1 = mock_SpatialSeries(name="test1", rate=None, data=test_data, timestamps=test_timestamps)
spatial_series2 = mock_SpatialSeries(name="test2", rate=None, data=test_data, timestamps=spatial_series1)
spatial_series3 = mock_SpatialSeries(name="test3", rate=None, data=test_data, timestamps=spatial_series1)
spatial_series4 = mock_SpatialSeries(name="test4", rate=None, data=test_data, timestamps=spatial_series1)
position = mock_Position(spatial_series=[spatial_series1, spatial_series2, spatial_series3, spatial_series4])

nwbfile.create_processing_module("behavior", description="contains processed behavior data")
nwbfile.processing["behavior"].add(position)

with NWBHDF5IO("test.nwb", "w") as io:
    io.write(nwbfile)

read_io = NWBHDF5IO("test.nwb", "r")
nwbfile_in = read_io.read()

nwbfile_in

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Does the PR clearly describe the problem and the solution?
  • Have you reviewed our Contributing Guide?
  • Does the PR use "Fix #XXX" notation to tell GitHub to close the relevant issue numbered XXX when the PR is merged?

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.53%. Comparing base (8ad4db2) to head (66ea6bb).
Report is 59 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1038   +/-   ##
=======================================
  Coverage   88.53%   88.53%           
=======================================
  Files          45       45           
  Lines        9603     9605    +2     
  Branches     2731     2732    +1     
=======================================
+ Hits         8502     8504    +2     
  Misses        778      778           
  Partials      323      323           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stephprince stephprince marked this pull request as ready for review February 8, 2024 21:46
@rly rly requested a review from oruebel February 8, 2024 22:32
rly
rly previously approved these changes Feb 8, 2024
@stephprince stephprince merged commit 0998190 into dev Feb 9, 2024
28 checks passed
@stephprince stephprince deleted the jupyter-recursion-error branch February 9, 2024 16:02
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.

HTML representation of nwbfile results in RecursionError
3 participants