|
6 | 6 |
|
7 | 7 | PyNWB supports linking between files using external links. |
8 | 8 |
|
9 | | -""" |
| 9 | +Example Use Case: Integrating data from multiple files |
| 10 | +--------------------------------------------------------- |
10 | 11 |
|
11 | | -#################### |
12 | | -# Example Use Case: Integrating data from multiple files |
13 | | -# --------------------------------------------------------- |
14 | | -# |
15 | | -# NBWContainer classes (e.g., :py:class:`~pynwb.base.TimeSeries`) support the integration of data stored in external |
16 | | -# HDF5 files with NWB data files via external links. To make things more concrete, let's look at the following use |
17 | | -# case. We want to simultaneously record multiple data streams during data acquisition. Using the concept of external |
18 | | -# links allows us to save each data stream to an external HDF5 files during data acquisition and to |
19 | | -# afterwards link the data into a single NWB:N file. In this case, each recording becomes represented by a |
20 | | -# separate file-system object that can be set as read-only once the experiment is done. In the following |
21 | | -# we are using :py:meth:`~pynwb.base.TimeSeries` as an example, but the same approach works for other |
22 | | -# NWBContainers as well. |
23 | | -# |
| 12 | +NBWContainer classes (e.g., :py:class:`~pynwb.base.TimeSeries`) support the integration of data stored in external |
| 13 | +HDF5 files with NWB data files via external links. To make things more concrete, let's look at the following use |
| 14 | +case. We want to simultaneously record multiple data streams during data acquisition. Using the concept of external |
| 15 | +links allows us to save each data stream to an external HDF5 files during data acquisition and to |
| 16 | +afterwards link the data into a single NWB file. In this case, each recording becomes represented by a |
| 17 | +separate file-system object that can be set as read-only once the experiment is done. In the following |
| 18 | +we are using :py:meth:`~pynwb.base.TimeSeries` as an example, but the same approach works for other |
| 19 | +NWBContainers as well. |
24 | 20 |
|
25 | | -#################### |
26 | | -# .. tip:: |
27 | | -# |
28 | | -# The same strategies we use here for creating External Links also apply to Soft Links. |
29 | | -# The main difference between soft and external links is that soft links point to other |
30 | | -# objects within the same file while external links point to objects in external files. |
31 | | -# |
| 21 | +.. tip:: |
32 | 22 |
|
33 | | -#################### |
34 | | -# .. tip:: |
35 | | -# |
36 | | -# In the case of :py:meth:`~pynwb.base.TimeSeries`, the uncorrected timestamps generated by the acquisition |
37 | | -# system can be stored (or linked) in the *sync* group. In the NWB:N format, hardware-recorded time data |
38 | | -# must then be corrected to a common time base (e.g., timestamps from all hardware sources aligned) before |
39 | | -# it can be included in the *timestamps* of the *TimeSeries*. This means, in the case |
40 | | -# of :py:meth:`~pynwb.base.TimeSeries` we need to be careful that we are not including data with incompatible |
41 | | -# timestamps in the same file when using external links. |
42 | | -# |
| 23 | + The same strategies we use here for creating External Links also apply to Soft Links. |
| 24 | + The main difference between soft and external links is that soft links point to other |
| 25 | + objects within the same file while external links point to objects in external files. |
43 | 26 |
|
44 | | -#################### |
45 | | -# .. warning:: |
46 | | -# |
47 | | -# External links can become stale/break. Since external links are pointing to data in other files |
48 | | -# external links may become invalid any time files are modified on the file system, e.g., renamed, |
49 | | -# moved or access permissions are changed. |
50 | | -# |
| 27 | + .. tip:: |
51 | 28 |
|
52 | | -#################### |
53 | | -# Creating test data |
54 | | -# --------------------------- |
55 | | -# |
56 | | -# In the following we are creating two :py:meth:`~pynwb.base.TimeSeries` each written to a separate file. |
57 | | -# We then show how we can integrate these files into a single NWBFile. |
| 29 | + In the case of :py:meth:`~pynwb.base.TimeSeries`, the uncorrected timestamps generated by the acquisition |
| 30 | + system can be stored (or linked) in the *sync* group. In the NWB format, hardware-recorded time data |
| 31 | + must then be corrected to a common time base (e.g., timestamps from all hardware sources aligned) before |
| 32 | + it can be included in the *timestamps* of the *TimeSeries*. This means, in the case |
| 33 | + of :py:meth:`~pynwb.base.TimeSeries` we need to be careful that we are not including data with incompatible |
| 34 | + timestamps in the same file when using external links. |
| 35 | +
|
| 36 | +
|
| 37 | +.. warning:: |
| 38 | +
|
| 39 | + External links can become stale/break. Since external links are pointing to data in other files |
| 40 | + external links may become invalid any time files are modified on the file system, e.g., renamed, |
| 41 | + moved or access permissions are changed. |
| 42 | +
|
| 43 | +
|
| 44 | +Creating test data |
| 45 | +--------------------------- |
| 46 | +
|
| 47 | +In the following we are creating two :py:meth:`~pynwb.base.TimeSeries` each written to a separate file. |
| 48 | +We then show how we can integrate these files into a single NWBFile. |
| 49 | +""" |
58 | 50 |
|
59 | 51 | # sphinx_gallery_thumbnail_path = 'figures/gallery_thumbnails_linking_data.png' |
| 52 | + |
60 | 53 | from datetime import datetime |
61 | 54 | from uuid import uuid4 |
62 | 55 |
|
|
228 | 221 | # Step 2: Add the container to another NWBFile |
229 | 222 | # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
230 | 223 | # To integrate both :py:meth:`~pynwb.base.TimeSeries` into a single file we simply create a new |
231 | | -# :py:meth:`~pynwb.file.NWBFile` and our existing :py:meth:`~pynwb.base.TimeSeries` to it. PyNWB's |
| 224 | +# :py:meth:`~pynwb.file.NWBFile` and add our existing :py:meth:`~pynwb.base.TimeSeries` to it. PyNWB's |
232 | 225 | # :py:class:`~pynwb.NWBHDF5IO` backend then automatically detects that the TimeSeries have already |
233 | 226 | # been written to another file and will create external links for us. |
234 | 227 | # |
|
0 commit comments