Skip to content

Commit 1317f7a

Browse files
authored
plot file (#1732)
1 parent b183e83 commit 1317f7a

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

docs/gallery/general/file.py renamed to docs/gallery/general/plot_file.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
experiment_description="I went on an adventure to reclaim vast treasures.", # optional
178178
related_publications="DOI:10.1016/j.neuron.2016.12.011", # optional
179179
)
180-
print(nwbfile)
180+
nwbfile
181181

182182
####################
183183
# .. note::
@@ -212,21 +212,25 @@
212212
# The fields in the :py:class:`~pynwb.file.Subject` object are all free-form text (any format will be valid),
213213
# however it is recommended to follow particular conventions to help software tools interpret the data:
214214
#
215-
# * **age**: `ISO 8601 Duration format <https://en.wikipedia.org/wiki/ISO_8601#Durations>`_, e.g., ``"P90D"`` for 90 days old
215+
# * **age**: `ISO 8601 Duration format <https://en.wikipedia.org/wiki/ISO_8601#Durations>`_, e.g., ``"P90D"`` for 90
216+
# days old
216217
# * **species**: The formal Latin binomial nomenclature, e.g., ``"Mus musculus"``, ``"Homo sapiens"``
217218
# * **sex**: Single letter abbreviation, e.g., ``"F"`` (female), ``"M"`` (male), ``"U"`` (unknown), and ``"O"`` (other)
218219
#
219220
# Add the subject information to the :py:class:`~pynwb.file.NWBFile`
220221
# by setting the ``subject`` field to the new :py:class:`~pynwb.file.Subject` object.
221222

222-
nwbfile.subject = Subject(
223+
subject = Subject(
223224
subject_id="001",
224225
age="P90D",
225226
description="mouse 5",
226227
species="Mus musculus",
227228
sex="M",
228229
)
229230

231+
nwbfile.subject = subject
232+
subject
233+
230234
####################
231235
# .. _basic_timeseries:
232236
#
@@ -254,6 +258,7 @@
254258
starting_time=0.0,
255259
rate=1.0,
256260
)
261+
time_series_with_rate
257262

258263
####################
259264
# For irregularly sampled recordings, we need to provide the ``timestamps`` for the ``data``:
@@ -265,6 +270,7 @@
265270
unit="m",
266271
timestamps=timestamps,
267272
)
273+
time_series_with_timestamps
268274

269275
####################
270276
# :py:class:`~pynwb.base.TimeSeries` objects can be added directly to :py:class:`~pynwb.file.NWBFile` using:
@@ -316,7 +322,7 @@
316322
# create fake data with shape (50, 2)
317323
# the first dimension should always represent time
318324
position_data = np.array([np.linspace(0, 10, 50), np.linspace(0, 8, 50)]).T
319-
position_timestamps = np.linspace(0, 50) / 200
325+
position_timestamps = np.linspace(0, 50).astype(float) / 200
320326

321327
spatial_series_obj = SpatialSeries(
322328
name="SpatialSeries",
@@ -325,12 +331,13 @@
325331
timestamps=position_timestamps,
326332
reference_frame="(0,0) is bottom left corner",
327333
)
328-
print(spatial_series_obj)
334+
spatial_series_obj
329335

330336
####################
331337
# To help data analysis and visualization tools know that this :py:class:`~pynwb.behavior.SpatialSeries` object
332338
# represents the position of the subject, store the :py:class:`~pynwb.behavior.SpatialSeries` object inside
333-
# of a :py:class:`~pynwb.behavior.Position` object, which can hold one or more :py:class:`~pynwb.behavior.SpatialSeries` objects.
339+
# of a :py:class:`~pynwb.behavior.Position` object, which can hold one or more :py:class:`~pynwb.behavior.SpatialSeries`
340+
# objects.
334341
#
335342
# .. only:: html
336343
#
@@ -350,6 +357,7 @@
350357

351358
# name is set to "Position" by default
352359
position_obj = Position(spatial_series=spatial_series_obj)
360+
position_obj
353361

354362
####################
355363
# Behavior Processing Module
@@ -395,7 +403,7 @@
395403
# Once the behavior processing module is added to the :py:class:`~pynwb.file.NWBFile`,
396404
# you can access it with:
397405

398-
print(nwbfile.processing["behavior"])
406+
nwbfile.processing["behavior"]
399407

400408
####################
401409
# .. _basic_writing:
@@ -559,7 +567,7 @@
559567
# :py:class:`~hdmf.common.table.DynamicTable` and its subclasses can be converted to a pandas
560568
# :py:class:`~pandas.DataFrame` for convenient analysis using :py:meth:`.DynamicTable.to_dataframe`.
561569

562-
print(nwbfile.trials.to_dataframe())
570+
nwbfile.trials.to_dataframe()
563571

564572
####################
565573
# .. _basic_epochs:
@@ -587,6 +595,8 @@
587595
timeseries=[time_series_with_timestamps],
588596
)
589597

598+
nwbfile.epochs.to_dataframe()
599+
590600
####################
591601
# Other time intervals
592602
# ^^^^^^^^^^^^^^^^^^^^

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class CustomSphinxGallerySectionSortKey(ExampleTitleSortKey):
7575
# listed here will be added in alphabetical order based on title after the
7676
# explicitly listed galleries
7777
GALLERY_ORDER = {
78-
'general': ['file.py'],
78+
'general': ['plot_file.py'],
7979
# Sort domain-specific tutorials based on domain to group tutorials belonging to the same domain
8080
'domain': [
8181
"ecephys.py",

0 commit comments

Comments
 (0)