Exemplo n.º 1
0
 def __init__(self, path):
     super(SigmoidalH5, self).__init__(path)
     self.cmin = DataSet(Sigmoidal.cmin, self)
     self.cmax = DataSet(Sigmoidal.cmax, self)
     self.midpoint = DataSet(Sigmoidal.midpoint, self)
     self.a = DataSet(Sigmoidal.a, self)
     self.sigma = DataSet(Sigmoidal.sigma, self)
Exemplo n.º 2
0
 def __init__(self, path):
     super(SigmoidalJansenRitH5, self).__init__(path)
     self.cmin = DataSet(SigmoidalJansenRit.cmin, self)
     self.cmax = DataSet(SigmoidalJansenRit.cmax, self)
     self.midpoint = DataSet(SigmoidalJansenRit.midpoint, self)
     self.r = DataSet(SigmoidalJansenRit.r, self)
     self.a = DataSet(SigmoidalJansenRit.a, self)
Exemplo n.º 3
0
    def __init__(self, path):
        super(TimeSeriesH5, self).__init__(path)
        self.title = Scalar(TimeSeries.title)
        self.data = DataSet(TimeSeries.data, expand_dimension=0)
        self.nr_dimensions = Scalar(TimeSeries.nr_dimensions)

        # omitted length_nd , these are indexing props, to be removed from datatype too
        self.labels_ordering = Json(TimeSeries.labels_ordering)
        self.labels_dimensions = Json(TimeSeries.labels_dimensions)

        self.time = DataSet(TimeSeries.time, expand_dimension=0)
        self.start_time = Scalar(TimeSeries.start_time)
        self.sample_period = Scalar(TimeSeries.sample_period)
        self.sample_period_unit = Scalar(TimeSeries.sample_period_unit)
        self.sample_rate = Scalar(TimeSeries.sample_rate)
        self._end_accessor_declarations()

        # omitted has_surface_mapping, has_volume_mapping, indexing props, to be removed fro datatype too

        # experiment: load header data eagerly, see surface for a lazy approach
        # as we do not explicitly make a difference between opening for read or write
        # the file might not yet exist, so loading headers makes no sense

        if self.storage_manager.is_valid_hdf5_file():
            self._sample_period = self.sample_period.load()
            self._start_time = self.start_time.load()
Exemplo n.º 4
0
    class PropsDataTypeFile(H5File):
        def __init__(self, path):
            super(PropsDataTypeFile, self).__init__(path)

            self.n_node = Scalar(PropsDataType.n_node, self)
            # You cannot define Accessors for trait_properties
            # You have to manually map them, using datatype independent accessors
            # breaks: self.weights = DataSet(PropsDataType.weights, self)
            self.weights = DataSet(NArray(), self, name='weights')
            # As any independent accessors weights will be ignored by H5File.load_into, H5File.store

            # Properties have no obvious serialization semantics.
            # They might not be writable or may need a specific initalisation order
            # in this case setting n_node before weights

            self.is_directed = Scalar(Attr(bool), self, name='is_directed')
            self.once = DataSet(NArray(), self, name='once')

        def store(self, datatype, scalars_only=False):
            super(PropsDataTypeFile, self).store(datatype,
                                                 scalars_only=scalars_only)
            # handle the trait_properties manually
            self.weights.store(datatype.weights)
            # is_directed is read only, We choose to store it in the h5 as an example
            # it will never be read from there.
            # One might want to store these in h5 so that manually opened h5 are more informative
            self.is_directed.store(datatype.is_directed)
            # self.once is read only, no need to store

        def load_into(self, datatype):
            super(PropsDataTypeFile, self).load_into(datatype)
            # n_node is loaded, so weights will not complain about missing shape info
            datatype.weights = self.weights.load()
Exemplo n.º 5
0
class ConnectivityH5(H5File):
    def __init__(self, path):
        super(ConnectivityH5, self).__init__(path)
        self.region_labels = DataSet(NArray(dtype=STORE_STRING), self, "region_labels")
        self.weights = DataSet(Connectivity.weights, self)
        self.undirected = Scalar(Connectivity.undirected, self)
        self.tract_lengths = DataSet(Connectivity.tract_lengths, self)
        self.centres = DataSet(Connectivity.centres, self)
        self.cortical = DataSet(Connectivity.cortical, self)
        self.hemispheres = DataSet(Connectivity.hemispheres, self)
        self.orientations = DataSet(Connectivity.orientations, self)
        self.areas = DataSet(Connectivity.areas, self)
        self.number_of_regions = Scalar(Connectivity.number_of_regions, self)
        self.number_of_connections = Scalar(Connectivity.number_of_connections, self)
        self.parent_connectivity = Scalar(Connectivity.parent_connectivity, self)
        self.saved_selection = Json(Connectivity.saved_selection, self)

    def get_centres(self):
        return self.centres.load()

    def get_region_labels(self):
        return self.region_labels.load()

    def store(self, datatype, scalars_only=False, store_references=False):
        # type: (Connectivity, bool, bool) -> None
        super(ConnectivityH5, self).store(datatype, scalars_only, store_references)
        self.region_labels.store(datatype.region_labels.astype(STORE_STRING))

    def load_into(self, datatype):
        # type: (Connectivity) -> None
        super(ConnectivityH5, self).load_into(datatype)
        datatype.region_labels = self.region_labels.load().astype(MEMORY_STRING)
Exemplo n.º 6
0
    def __init__(self, path):
        super(TimeSeriesH5, self).__init__(path)
        self.title = Scalar(TimeSeries.title, self)
        self.data = DataSet(TimeSeries.data, self, expand_dimension=0)
        self.nr_dimensions = Scalar(Int(), self, name="nr_dimensions")

        # omitted length_nd , these are indexing props, to be removed from datatype too
        self.labels_ordering = Json(TimeSeries.labels_ordering, self)
        self.labels_dimensions = Json(TimeSeries.labels_dimensions, self)

        self.time = DataSet(TimeSeries.time, self, expand_dimension=0)
        self.start_time = Scalar(TimeSeries.start_time, self)
        self.sample_period = Scalar(TimeSeries.sample_period, self)
        self.sample_period_unit = Scalar(TimeSeries.sample_period_unit, self)
        self.sample_rate = Scalar(Float(), self, name="sample_rate")

        # omitted has_surface_mapping, has_volume_mapping, indexing props, to be removed fro datatype too

        # experiment: load header data eagerly, see surface for a lazy approach
        # as we do not explicitly make a difference between opening for read or write
        # the file might not yet exist, so loading headers makes no sense

        if not self.is_new_file:
            self._sample_period = self.sample_period.load()
            self._start_time = self.start_time.load()
Exemplo n.º 7
0
class CrossCorrelationH5(H5File):
    def __init__(self, path):
        super(CrossCorrelationH5, self).__init__(path)
        self.array_data = DataSet(CrossCorrelation.array_data,
                                  self,
                                  expand_dimension=3)
        self.source = Reference(CrossCorrelation.source, self)
        self.time = DataSet(CrossCorrelation.time, self)
        self.labels_ordering = Json(CrossCorrelation.labels_ordering, self)

    def read_data_shape(self):
        """
        The shape of the data
        """
        return self.array_data.shape

    def read_data_slice(self, data_slice):
        """
        Expose chunked-data access.
        """
        return self.array_data[data_slice]

    def write_data_slice(self, partial_result):
        """
        Append chunk.
        """
        self.array_data.append(partial_result.array_data)
Exemplo n.º 8
0
class SensorsH5(H5File):
    def __init__(self, path):
        super(SensorsH5, self).__init__(path)
        self.sensors_type = Scalar(Sensors.sensors_type, self)
        self.labels = DataSet(NArray(dtype=STORE_STRING), self, "labels")
        self.locations = DataSet(Sensors.locations, self)
        self.has_orientation = Scalar(Sensors.has_orientation, self)
        self.orientations = DataSet(Sensors.orientations, self)
        self.number_of_sensors = Scalar(Sensors.number_of_sensors, self)
        self.usable = DataSet(Sensors.usable, self)

    def get_locations(self):
        return self.locations.load()

    def get_labels(self):
        return self.labels.load()

    def store(self, datatype, scalars_only=False, store_references=False):
        # type: (Sensors, bool, bool) -> None
        super(SensorsH5, self).store(datatype, scalars_only, store_references)
        self.labels.store(datatype.labels.astype(STORE_STRING))

    def load_into(self, datatype):
        # type: (Sensors) -> None
        super(SensorsH5, self).load_into(datatype)
        datatype.labels = self.labels.load().astype(MEMORY_STRING)
Exemplo n.º 9
0
class SimulatorH5(SimulatorConfigurationH5):
    def __init__(self, path):
        super(SimulatorH5, self).__init__(path)
        self.connectivity = Reference(Simulator.connectivity, self)
        self.conduction_speed = Scalar(Simulator.conduction_speed, self)
        self.coupling = Reference(Simulator.coupling, self)
        self.surface = Reference(Simulator.surface, self)
        self.stimulus = Reference(Simulator.stimulus, self)
        self.model = Reference(Simulator.model, self)
        self.integrator = Reference(Simulator.integrator, self)
        self.initial_conditions = DataSet(Simulator.initial_conditions, self)
        self.monitors = Json(Simulator.monitors, self)
        self.simulation_length = Scalar(Simulator.simulation_length, self)
        self.simulation_state = Reference(Attr(field_type=uuid.UUID),
                                          self,
                                          name='simulation_state')

    def store(self, datatype, scalars_only=False, store_references=False):
        # type: (Simulator, bool, bool) -> None
        self.gid.store(datatype.gid)
        self.connectivity.store(datatype.connectivity)
        self.conduction_speed.store(datatype.conduction_speed)
        self.initial_conditions.store(datatype.initial_conditions)
        self.simulation_length.store(datatype.simulation_length)

        integrator_gid = self.store_config_as_reference(datatype.integrator)
        self.integrator.store(integrator_gid)

        coupling_gid = self.store_config_as_reference(datatype.coupling)
        self.coupling.store(coupling_gid)

        model_gid = self.store_config_as_reference(datatype.model)
        self.model.store(model_gid)

        # TODO: handle multiple monitors
        monitor_gid = self.store_config_as_reference(datatype.monitors[0])
        self.monitors.store([monitor_gid.hex])

        if datatype.surface:
            cortex_gid = self.store_config_as_reference(datatype.surface)
            self.surface.store(cortex_gid)

        if datatype.stimulus:
            self.stimulus.store(datatype.stimulus)

        self.type.store(self.get_full_class_name(type(datatype)))

    def load_into(self, datatype):
        # type: (Simulator) -> None
        datatype.conduction_speed = self.conduction_speed.load()
        datatype.initial_conditions = self.initial_conditions.load()
        datatype.simulation_length = self.simulation_length.load()
        datatype.integrator = self.load_from_reference(self.integrator.load())
        datatype.coupling = self.load_from_reference(self.coupling.load())
        datatype.model = self.load_from_reference(self.model.load())
        # TODO: handle multiple monitors
        datatype.monitors = [self.load_from_reference(self.monitors.load()[0])]
        if self.surface.load():
            datatype.surface = self.load_from_reference(self.surface.load())
Exemplo n.º 10
0
 def __init__(self, path):
     super(CoherenceSpectrumH5, self).__init__(path)
     self.array_data = DataSet(CoherenceSpectrum.array_data,
                               self,
                               expand_dimension=3)
     self.source = Reference(CoherenceSpectrum.source, self)
     self.nfft = Scalar(CoherenceSpectrum.nfft, self)
     self.frequency = DataSet(CoherenceSpectrum.frequency, self)
Exemplo n.º 11
0
 def __init__(self, path):
     super(CrossCorrelationH5, self).__init__(path)
     self.array_data = DataSet(CrossCorrelation.array_data,
                               self,
                               expand_dimension=3)
     self.source = Reference(CrossCorrelation.source, self)
     self.time = DataSet(CrossCorrelation.time, self)
     self.labels_ordering = Json(CrossCorrelation.labels_ordering, self)
Exemplo n.º 12
0
class ComplexCoherenceSpectrumH5(DataTypeMatrixH5):
    spectrum_types = ["Imaginary", "Real", "Absolute"]

    def __init__(self, path):
        super(ComplexCoherenceSpectrumH5, self).__init__(path)
        self.cross_spectrum = DataSet(ComplexCoherenceSpectrum.cross_spectrum,
                                      self,
                                      expand_dimension=2)
        self.array_data = DataSet(ComplexCoherenceSpectrum.array_data,
                                  self,
                                  expand_dimension=2)
        self.source = Reference(ComplexCoherenceSpectrum.source, self)
        self.epoch_length = Scalar(ComplexCoherenceSpectrum.epoch_length, self)
        self.segment_length = Scalar(ComplexCoherenceSpectrum.segment_length,
                                     self)
        self.windowing_function = Scalar(
            ComplexCoherenceSpectrum.windowing_function, self)

    def write_data_slice(self, partial_result):
        """
        Append chunk.
        """
        self.cross_spectrum.append(partial_result.cross_spectrum,
                                   close_file=False)

        self.array_data.append(partial_result.array_data, close_file=False)

    def get_spectrum_data(self, selected_spectrum):
        shape = self.array_data.shape
        slices = (slice(shape[0]), slice(shape[1]), slice(shape[2]))

        if selected_spectrum == self.spectrum_types[0]:
            data_matrix = self.array_data[slices].imag
            indices = numpy.triu_indices(shape[0], 1)
            data_matrix = data_matrix[indices]

        elif selected_spectrum == self.spectrum_types[1]:
            data_matrix = self.array_data[slices].real
            data_matrix = data_matrix.reshape(shape[0] * shape[0], shape[2])

        else:
            data_matrix = self.array_data[slices]
            data_matrix = numpy.absolute(data_matrix)
            data_matrix = data_matrix.reshape(shape[0] * shape[0], shape[2])

        coh_spec_sd = numpy.std(data_matrix, axis=0)
        coh_spec_av = numpy.mean(data_matrix, axis=0)

        ymin = numpy.amin(coh_spec_av - coh_spec_sd)
        ymax = numpy.amax(coh_spec_av + coh_spec_sd)

        coh_spec_sd = json.dumps(coh_spec_sd.tolist())
        coh_spec_av = json.dumps(coh_spec_av.tolist())

        return dict(coh_spec_sd=coh_spec_sd,
                    coh_spec_av=coh_spec_av,
                    ymin=ymin,
                    ymax=ymax)
Exemplo n.º 13
0
 def __init__(self, path):
     super(PreSigmoidalH5, self).__init__(path)
     self.H = DataSet(PreSigmoidal.H, self)
     self.Q = DataSet(PreSigmoidal.Q, self)
     self.G = DataSet(PreSigmoidal.G, self)
     self.P = DataSet(PreSigmoidal.P, self)
     self.theta = DataSet(PreSigmoidal.theta, self)
     self.dynamic = Scalar(PreSigmoidal.dynamic, self)
     self.globalT = Scalar(PreSigmoidal.globalT, self)
Exemplo n.º 14
0
 def __init__(self, path):
     super(StimuliSurfaceH5, self).__init__(path)
     self.spatial = Scalar(Attr(str), self, name='spatial')
     self.temporal = Scalar(Attr(str), self, name='temporal')
     self.surface = Reference(StimuliSurface.surface, self)
     self.focal_points_surface = DataSet(
         StimuliSurface.focal_points_surface, self)
     self.focal_points_triangles = DataSet(
         StimuliSurface.focal_points_triangles, self)
Exemplo n.º 15
0
 def __init__(self, path):
     super(SupHopfH5, self).__init__(path)
     self.a = DataSet(SupHopf.a, self)
     self.omega = DataSet(SupHopf.omega, self)
     self.state_variable_range = JsonFinal(
         SupHopf.state_variable_range,
         self,
         json_encoder=StateVariablesEncoder,
         json_decoder=StateVariablesDecoder)
     self.variables_of_interest = Json(SupHopf.variables_of_interest, self)
Exemplo n.º 16
0
 def __init__(self, path):
     super(StimuliSurfaceH5, self).__init__(path)
     self.spatial = EquationScalar(StimuliSurface.spatial, self)
     self.temporal = EquationScalar(StimuliSurface.temporal, self)
     self.surface = Reference(StimuliSurface.surface, self)
     self.focal_points_surface = DataSet(NArray(dtype=int),
                                         self,
                                         name='focal_points_surface')
     self.focal_points_triangles = DataSet(
         StimuliSurface.focal_points_triangles, self)
Exemplo n.º 17
0
    def __init__(self, path):
        super(SurfaceH5, self).__init__(path)
        self.vertices = DataSet(Surface.vertices, self)
        self.triangles = DataSet(Surface.triangles, self)
        self.vertex_normals = DataSet(Surface.vertex_normals, self)
        self.triangle_normals = DataSet(Surface.triangle_normals, self)
        self.number_of_vertices = Scalar(Surface.number_of_vertices, self)
        self.number_of_triangles = Scalar(Surface.number_of_triangles, self)
        self.edge_mean_length = Scalar(Surface.edge_mean_length, self)
        self.edge_min_length = Scalar(Surface.edge_min_length, self)
        self.edge_max_length = Scalar(Surface.edge_max_length, self)
        self.zero_based_triangles = Scalar(Surface.zero_based_triangles, self)

        self.split_triangles = DataSet(NArray(dtype=int), self, name="split_triangles")
        self.number_of_split_slices = Scalar(Int(), self, name="number_of_split_slices")
        self.split_slices = Json(Attr(field_type=dict), self, name="split_slices")

        self.bi_hemispheric = Scalar(Surface.bi_hemispheric, self)
        self.surface_type = Scalar(Surface.surface_type, self)
        self.valid_for_simulations = Scalar(Surface.valid_for_simulations, self)

        # cached header like information, needed to interpret the rest of the file
        # Load the data that is required in order to interpret the file format
        # number_of_vertices and split_slices are needed for the get_vertices_slice read call

        if not self.is_new_file:
            self._split_slices = self.split_slices.load()
            self._split_triangles = self.split_triangles.load()
            self._number_of_vertices = self.number_of_vertices.load()
            self._number_of_triangles = self.number_of_triangles.load()
            self._number_of_split_slices = self.number_of_split_slices.load()
            self._bi_hemispheric = self.bi_hemispheric.load()
Exemplo n.º 18
0
 def __init__(self, path):
     super(SupHopfH5, self).__init__(path)
     self.a = DataSet(ModelsEnum.SUP_HOPF.get_class().a, self)
     self.omega = DataSet(ModelsEnum.SUP_HOPF.get_class().omega, self)
     self.state_variable_range = JsonFinal(
         ModelsEnum.SUP_HOPF.get_class().state_variable_range,
         self,
         json_encoder=StateVariablesEncoder,
         json_decoder=StateVariablesDecoder)
     self.variables_of_interest = Json(
         ModelsEnum.SUP_HOPF.get_class().variables_of_interest, self)
Exemplo n.º 19
0
 def __init__(self, path):
     super(HopfieldH5, self).__init__(path)
     self.taux = DataSet(Hopfield.taux, self)
     self.tauT = DataSet(Hopfield.tauT, self)
     self.dynamic = DataSet(Hopfield.dynamic, self)
     self.state_variable_range = JsonFinal(
         Hopfield.state_variable_range,
         self,
         json_encoder=StateVariablesEncoder,
         json_decoder=StateVariablesDecoder)
     self.variables_of_interest = Json(Hopfield.variables_of_interest, self)
Exemplo n.º 20
0
 def __init__(self, path):
     super(HopfieldH5, self).__init__(path)
     self.taux = DataSet(ModelsEnum.HOPFIELD.get_class().taux, self)
     self.tauT = DataSet(ModelsEnum.HOPFIELD.get_class().tauT, self)
     self.dynamic = DataSet(ModelsEnum.HOPFIELD.get_class().dynamic, self)
     self.state_variable_range = JsonFinal(
         ModelsEnum.HOPFIELD.get_class().state_variable_range,
         self,
         json_encoder=StateVariablesEncoder,
         json_decoder=StateVariablesDecoder)
     self.variables_of_interest = Json(
         ModelsEnum.HOPFIELD.get_class().variables_of_interest, self)
Exemplo n.º 21
0
class CovarianceH5(DataTypeMatrixH5):
    def __init__(self, path):
        super(CovarianceH5, self).__init__(path)
        self.array_data = DataSet(Covariance.array_data,
                                  self,
                                  expand_dimension=2)
        self.source = Reference(Covariance.source, self)

    def write_data_slice(self, partial_result):
        """
        Append chunk.
        """
        self.array_data.append(partial_result, close_file=False)
Exemplo n.º 22
0
 def __init__(self, path):
     super(ReducedSetFitzHughNagumoH5, self).__init__(path)
     self.tau = DataSet(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().tau, self)
     self.a = DataSet(ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().a,
                      self)
     self.b = DataSet(ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().b,
                      self)
     self.K11 = DataSet(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().K11, self)
     self.K12 = DataSet(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().K12, self)
     self.K21 = DataSet(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().K21, self)
     self.sigma = DataSet(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().sigma, self)
     self.mu = DataSet(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().mu, self)
     self.state_variable_range = JsonFinal(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class(
         ).state_variable_range,
         self,
         json_encoder=StateVariablesEncoder,
         json_decoder=StateVariablesDecoder)
     self.variables_of_interest = Json(
         ModelsEnum.REDUCED_SET_FITZ_HUGH_NAGUMO.get_class().
         variables_of_interest, self)
Exemplo n.º 23
0
 def __init__(self, path):
     super(ComplexCoherenceSpectrumH5, self).__init__(path)
     self.cross_spectrum = DataSet(ComplexCoherenceSpectrum.cross_spectrum,
                                   self,
                                   expand_dimension=2)
     self.array_data = DataSet(ComplexCoherenceSpectrum.array_data,
                               self,
                               expand_dimension=2)
     self.source = Reference(ComplexCoherenceSpectrum.source, self)
     self.epoch_length = Scalar(ComplexCoherenceSpectrum.epoch_length, self)
     self.segment_length = Scalar(ComplexCoherenceSpectrum.segment_length,
                                  self)
     self.windowing_function = Scalar(
         ComplexCoherenceSpectrum.windowing_function, self)
Exemplo n.º 24
0
class CoherenceSpectrumH5(DataTypeMatrixH5):
    def __init__(self, path):
        super(CoherenceSpectrumH5, self).__init__(path)
        self.array_data = DataSet(CoherenceSpectrum.array_data,
                                  self,
                                  expand_dimension=3)
        self.source = Reference(CoherenceSpectrum.source, self)
        self.nfft = Scalar(CoherenceSpectrum.nfft, self)
        self.frequency = DataSet(CoherenceSpectrum.frequency, self)

    def write_data_slice(self, partial_result):
        """
        Append chunk.
        """
        self.array_data.append(partial_result.array_data)
Exemplo n.º 25
0
class StimuliSurfaceH5(H5File):
    def __init__(self, path):
        super(StimuliSurfaceH5, self).__init__(path)
        self.spatial = EquationScalar(StimuliSurface.spatial, self)
        self.temporal = EquationScalar(StimuliSurface.temporal, self)
        self.surface = Reference(StimuliSurface.surface, self)
        self.focal_points_surface = DataSet(NArray(dtype=int),
                                            self,
                                            name='focal_points_surface')
        self.focal_points_triangles = DataSet(
            StimuliSurface.focal_points_triangles, self)

    def store(self, datatype, scalars_only=False):
        super(StimuliSurfaceH5, self).store(datatype, scalars_only)
        self.focal_points_surface.store(datatype.focal_points_surface)
Exemplo n.º 26
0
 def __init__(self, path):
     super(ConnectivityH5, self).__init__(path)
     self.region_labels = DataSet(NArray(dtype=STORE_STRING), self, "region_labels")
     self.weights = DataSet(Connectivity.weights, self)
     self.undirected = Scalar(Connectivity.undirected, self)
     self.tract_lengths = DataSet(Connectivity.tract_lengths, self)
     self.centres = DataSet(Connectivity.centres, self)
     self.cortical = DataSet(Connectivity.cortical, self)
     self.hemispheres = DataSet(Connectivity.hemispheres, self)
     self.orientations = DataSet(Connectivity.orientations, self)
     self.areas = DataSet(Connectivity.areas, self)
     self.number_of_regions = Scalar(Connectivity.number_of_regions, self)
     self.number_of_connections = Scalar(Connectivity.number_of_connections, self)
     self.parent_connectivity = Scalar(Connectivity.parent_connectivity, self)
     self.saved_selection = Json(Connectivity.saved_selection, self)
Exemplo n.º 27
0
 def __init__(self, path):
     super(SimulatorH5, self).__init__(path)
     self.connectivity = Reference(Simulator.connectivity, self)
     self.conduction_speed = Scalar(Simulator.conduction_speed, self)
     self.coupling = Reference(Simulator.coupling, self)
     self.surface = Reference(Simulator.surface, self)
     self.stimulus = Reference(Simulator.stimulus, self)
     self.model = Reference(Simulator.model, self)
     self.integrator = Reference(Simulator.integrator, self)
     self.initial_conditions = DataSet(Simulator.initial_conditions, self)
     self.monitors = Json(Simulator.monitors, self)
     self.simulation_length = Scalar(Simulator.simulation_length, self)
     self.simulation_state = Reference(Attr(field_type=uuid.UUID),
                                       self,
                                       name='simulation_state')
Exemplo n.º 28
0
        def __init__(self, path):
            super(PropsDataTypeFile, self).__init__(path)

            self.n_node = Scalar(PropsDataType.n_node, self)
            # You cannot define Accessors for trait_properties
            # You have to manually map them, using datatype independent accessors
            # breaks: self.weights = DataSet(PropsDataType.weights, self)
            self.weights = DataSet(NArray(), self, name='weights')
            # As any independent accessors weights will be ignored by H5File.load_into, H5File.store

            # Properties have no obvious serialization semantics.
            # They might not be writable or may need a specific initalisation order
            # in this case setting n_node before weights

            self.is_directed = Scalar(Attr(bool), self, name='is_directed')
            self.once = DataSet(NArray(), self, name='once')
Exemplo n.º 29
0
 def __init__(self, path):
     super(FcdH5, self).__init__(path)
     self.array_data = DataSet(Fcd.array_data, self)
     self.source = Reference(Fcd.source, self)
     self.sw = Scalar(Fcd.sw, self)
     self.sp = Scalar(Fcd.sp, self)
     self.labels_ordering = Json(Fcd.labels_ordering, self)
    def __init__(self, path):
        super(SimulationHistoryH5, self).__init__(path)
        self.history = DataSet(SimulationHistory.history, self)
        self.current_state = DataSet(SimulationHistory.current_state, self)
        self.current_step = Scalar(SimulationHistory.current_step, self)

        self.monitor_names = Json(SimulationHistory.monitor_names, self)
        for i in range(1, 16):
            stock_name = 'monitor_stock_%i' % i
            setattr(self, stock_name, DataSet(getattr(SimulationHistory, stock_name), self))

        self.integrator_noise_rng_state_algo = Scalar(SimulationHistory.integrator_noise_rng_state_algo, self)
        self.integrator_noise_rng_state_keys = DataSet(SimulationHistory.integrator_noise_rng_state_keys, self)
        self.integrator_noise_rng_state_pos = Scalar(SimulationHistory.integrator_noise_rng_state_pos, self)
        self.integrator_noise_rng_state_has_gauss = Scalar(SimulationHistory.integrator_noise_rng_state_has_gauss, self)
        self.integrator_noise_rng_state_cached_gauss = Scalar(SimulationHistory.integrator_noise_rng_state_cached_gauss,
                                                              self)