pynwb.io.file module

class pynwb.io.file.NWBFileMap(spec)[source]

Bases: ObjectMapper

Create a map from AbstractContainer attributes to specifications

Parameters:

spec (DatasetSpec or GroupSpec) – The specification for mapping objects to builders

scratch_datas(container, manager)[source]

Set the value for the ‘scratch_datas’ spec on NWBFile to a list of ScratchData objects.

Used when writing (building) the NWBFile container to a file.

The ‘scratch’ group can contain both groups and datasets. This mapping function is used when writing the value for the ‘scratch_datas’ spec (ScratchData type – see __init__ above). The value is set to a list of all ScratchData objects in the ‘scratch’ field of the NWBFile container.

scratch_containers(container, manager)[source]

Set the value for the ‘scratch_containers’ spec on NWBFile to a list of non-ScratchData objects.

Used when writing (building) the NWBFile container to a file.

The ‘scratch’ group can contain both groups and datasets. This mapping function is used when writing the value for the ‘scratch_containers’ spec (NWBContainers and DynamicTable type – see __init__ above). The value is set to a list of all non-ScratchData objects in the ‘scratch’ field of the NWBFile container.

scratch(builder, manager)[source]

Set the constructor arg for ‘scratch’ to a tuple of objects.

Used when constructing the NWBFile container from a written file.

The ‘scratch’ group can contain both groups and datasets. This mapping function is used to construct the contained groups and datasets and put them into a single field ‘scratch’ on the NWBFile container for user convenience.

dateconversion(builder, manager)[source]

Set the constructor arg for ‘session_start_time’ to a datetime object.

Used when constructing the NWBFile container from a written file.

Dates are read into builders as strings and are parsed into datetime objects for user convenience and consistency with how they are written.

dateconversion_trt(builder, manager)[source]

Set the constructor arg for ‘timestamps_reference_time’ to a datetime object.

Used when constructing the NWBFile container from a written file.

Dates are read into builders as strings and are parsed into datetime objects for user convenience and consistency with how they are written.

dateconversion_list(builder, manager)[source]

Set the constructor arg for ‘file_create_date’ to a datetime object.

Used when constructing the NWBFile container from a written file.

Dates are read into builders as strings and are parsed into datetime objects for user convenience and consistency with how they are written.

experimenter_carg(builder, manager)[source]

Set the constructor arg for ‘experimenter’ to a tuple if the builder value is a string.

Used when constructing the NWBFile container from a written file.

In early versions of the NWB 2 schema, ‘experimenter’ was specified as a string. Then it was changed to be a 1-D array of strings. This mapping function is necessary to allow reading of both data where ‘experimenter’ was specified as a string and data where ‘experimenter’ was specified as an array.

experimenter_obj_attr(container, manager)[source]

Change the value for the field ‘experimenter’ on NWBFile to a tuple if it is a string.

Used when writing (building) the NWBFile container to a file.

In early versions of the NWB 2 schema, ‘experimenter’ was specified as a string. Then it was changed to be a 1-D array of strings. This mapping function is necessary for writing a valid ‘experimenter’ array if it is a string in the NWBFile container.

publications_carg(builder, manager)[source]

Set the constructor arg for ‘related_publications’ to a tuple if the builder value is a string.

Used when constructing the NWBFile container from a written file.

In early versions of the NWB 2 schema, ‘related_publications’ was specified as a string. Then it was changed to be a 1-D array of strings. This mapping function is necessary to allow reading of both data where ‘related_publications’ was specified as a string and data where ‘related_publications’ was specified as an array.

publication_obj_attr(container, manager)[source]

Change the value for the field ‘related_publications’ on NWBFile to a tuple if it is a string.

Used when writing (building) the NWBFile container to a file.

In early versions of the NWB 2 schema, ‘related_publications’ was specified as a string. Then it was changed to be a 1-D array of strings. This mapping function is necessary for writing a valid ‘related_publications’ array if it is a string in the NWBFile container.

constructor_args = {'experimenter': <function NWBFileMap.experimenter_carg>, 'file_create_date': <function NWBFileMap.dateconversion_list>, 'name': <function ObjectMapper.get_container_name>, 'related_publications': <function NWBFileMap.publications_carg>, 'scratch': <function NWBFileMap.scratch>, 'session_start_time': <function NWBFileMap.dateconversion>, 'timestamps_reference_time': <function NWBFileMap.dateconversion_trt>}
obj_attrs = {'experimenter': <function NWBFileMap.experimenter_obj_attr>, 'related_publications': <function NWBFileMap.publication_obj_attr>, 'scratch_containers': <function NWBFileMap.scratch_containers>, 'scratch_datas': <function NWBFileMap.scratch_datas>}
class pynwb.io.file.SubjectMap(spec)[source]

Bases: ObjectMapper

Create a map from AbstractContainer attributes to specifications

Parameters:

spec (DatasetSpec or GroupSpec) – The specification for mapping objects to builders

dateconversion(builder, manager)[source]

Set the constructor arg for ‘date_of_birth’ to a datetime object.

Used when constructing the Subject container from a written file.

Dates are read into builders as strings and are parsed into datetime objects for user convenience and consistency with how they are written.

age_reference_none(builder, manager)[source]

Set the constructor arg for ‘age__reference’ to “unspecified” for NWB files < 2.6, else “birth”.

Used when constructing the Subject container from a written file.

NWB schema 2.6.0 introduced a new optional attribute ‘reference’ on the ‘age’ dataset with a default value of “birth”. When data written with NWB versions < 2.6 are read, ‘age__reference’ is set to “unspecified” in the Subject constructor. “unspecified” is a special non-None placeholder value that is handled specially in Subject.__init__ to distinguish it from no value being provided by the user. When data written with NWB versions >= 2.6 are read, ‘age__reference’ is set to the default value, “birth”, in the Subject constructor (this is not strictly necessary because Subject.__init__ has default value “birth” for ‘age__reference’).

constructor_args = {'age__reference': <function SubjectMap.age_reference_none>, 'date_of_birth': <function SubjectMap.dateconversion>, 'name': <function ObjectMapper.get_container_name>}
obj_attrs = {}