Esempio n. 1
0
class NodeCoherenceModel(ViewModel):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label="Time Series",
        required=True,
        doc="""The timeseries to which the Cross Coherence is to be applied."""
    )

    nfft = Int(label="Data-points per block",
               default=256,
               doc="""Should be a power of 2...""")
class RegionStimulusCreatorModel(ViewModel, StimuliRegion):
    connectivity = DataTypeGidAttr(
        field_type=uuid.UUID,
        linked_datatype=Connectivity,
        label="Connectivity"
    )

    display_name = Str(
        label='Display name',
        required=False
    )
Esempio n. 3
0
class MatrixVisualizerModel(ViewModel):
    datatype = DataTypeGidAttr(
        linked_datatype=DataTypeMatrix,
        label='Array data type'
    )

    slice = Attr(
        field_type=str,
        required=False,
        label='slice indices in numpy syntax'
    )
Esempio n. 4
0
class ICAAdapterModel(ViewModel):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label="Time Series",
        required=True,
        doc="The timeseries to which the ICA is to be applied.")

    n_components = Int(label="Number of principal components to unmix.",
                       required=False,
                       default=None,
                       doc="Number of principal components to unmix.")
Esempio n. 5
0
class BaseSurfaceViewerModel(ViewModel):
    region_map = DataTypeGidAttr(
        linked_datatype=RegionMapping,
        required=False,
        label='Region mapping',
        doc='A region map'
    )

    connectivity_measure = DataTypeGidAttr(
        linked_datatype=ConnectivityMeasure,
        required=False,
        label='Connectivity measure',
        doc='A connectivity measure'
    )

    shell_surface = DataTypeGidAttr(
        linked_datatype=Surface,
        required=False,
        label='Shell Surface',
        doc='Face surface to be displayed semi-transparently, for orientation only.'
    )
Esempio n. 6
0
class TopographicViewerModel(ViewModel):
    data_0 = DataTypeGidAttr(
        linked_datatype=ConnectivityMeasure,
        label='Connectivity Measures 1',
        doc='Punctual values for each node in the connectivity matrix. This will '
            'give the colors of the resulting topographic image.'
    )

    data_1 = DataTypeGidAttr(
        linked_datatype=ConnectivityMeasure,
        required=False,
        label='Connectivity Measures 2',
        doc='Comparative values'
    )

    data_2 = DataTypeGidAttr(
        linked_datatype=ConnectivityMeasure,
        required=False,
        label='Connectivity Measures 3',
        doc='Comparative values'
    )
Esempio n. 7
0
class SurfaceStimulusCreatorModel(ViewModel, StimuliSurface):
    spatial = EnumAttr(field_type=SpatialEquationsEnum,
                       label="Spatial Equation",
                       default=SpatialEquationsEnum.SIGMOID.instance)
    temporal = EnumAttr(field_type=TemporalEquationsEnum,
                        label="Temporal Equation",
                        default=TemporalEquationsEnum.PULSETRAIN.instance)

    surface = DataTypeGidAttr(linked_datatype=CorticalSurface,
                              label=StimuliSurface.surface.label)

    display_name = Str(label='Display name', required=False)
Esempio n. 8
0
class CortexViewModel(ViewModel, Cortex):
    @property
    def linked_has_traits(self):
        return Cortex

    surface_gid = DataTypeGidAttr(linked_datatype=CorticalSurface,
                                  label=Simulator.surface.label,
                                  default=Simulator.surface.default,
                                  required=Simulator.surface.required,
                                  doc=Simulator.surface.doc)

    local_connectivity = DataTypeGidAttr(
        linked_datatype=LocalConnectivity,
        required=Cortex.local_connectivity.required,
        label=Cortex.local_connectivity.label,
        doc=Cortex.local_connectivity.doc)

    region_mapping_data = DataTypeGidAttr(
        linked_datatype=RegionMapping,
        label=Cortex.region_mapping_data.label,
        doc=Cortex.region_mapping_data.doc)
Esempio n. 9
0
class BalloonModelAdapterModel(ViewModel):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeriesRegion,
        label="Time Series",
        required=True,
        doc="""The timeseries that represents the input neural activity""")

    dt = Float(label=":math:`dt`",
               default=0.002,
               required=True,
               doc="""The integration time step size for the balloon model (s).
            If none is provided, by default, the TimeSeries sample period is used."""
               )

    tau_s = Float(label=r":math:`\tau_s`",
                  default=1.54,
                  required=True,
                  doc="""Balloon model parameter. Time of signal decay (s)""")

    tau_f = Float(
        label=r":math:`\tau_f`",
        default=1.44,
        required=True,
        doc=""" Balloon model parameter. Time of flow-dependent elimination or
            feedback regulation (s). The average  time blood take to traverse the
            venous compartment. It is the  ratio of resting blood volume (V0) to
            resting blood flow (F0).""")

    neural_input_transformation = Attr(
        field_type=str,
        label="Neural input transformation",
        choices=("none", "abs_diff", "sum"),
        default="none",
        doc=
        """ This represents the operation to perform on the state-variable(s) of
            the model used to generate the input TimeSeries. ``none`` takes the
            first state-variable as neural input; `` abs_diff`` is the absolute
            value of the derivative (first order difference) of the first state variable; 
            ``sum``: sum all the state-variables of the input TimeSeries.""")

    bold_model = Attr(
        field_type=str,
        label="Select BOLD model equations",
        choices=("linear", "nonlinear"),
        default="nonlinear",
        doc="""Select the set of equations for the BOLD model.""")

    RBM = Attr(field_type=bool,
               label="Revised BOLD Model",
               default=True,
               required=True,
               doc="""Select classical vs revised BOLD model (CBM or RBM).
            Coefficients  k1, k2 and k3 will be derived accordingly.""")
Esempio n. 10
0
class SurfaceStimulusCreatorModel(ViewModel, StimuliSurface):
    spatial = Attr(field_type=FiniteSupportEquation,
                   label="Spatial Equation",
                   default=Sigmoid())
    temporal = Attr(field_type=TemporalApplicableEquation,
                    label="Temporal Equation",
                    default=PulseTrain())

    surface = DataTypeGidAttr(linked_datatype=CorticalSurface,
                              label=StimuliSurface.surface.label)

    display_name = Str(label='Display name', required=False)
Esempio n. 11
0
class ICAModel(ViewModel):
    datatype = DataTypeGidAttr(linked_datatype=IndependentComponents,
                               label='Independent component analysis:')

    i_svar = Attr(
        field_type=int,
        default=0,
        label='Index of state variable (defaults to first state variable)')

    i_mode = Attr(field_type=int,
                  default=0,
                  label='Index of mode (defaults to first mode)')
class ConnectivityMeasureImporterModel(UploaderViewModel):
    data_file = Str(label='Connectivity measure file (.mat format)')

    dataset_name = Attr(field_type=str,
                        default='M',
                        label='Matlab dataset name',
                        doc='Name of the MATLAB dataset where data is stored')

    connectivity = DataTypeGidAttr(
        linked_datatype=Connectivity,
        label='Large Scale Connectivity',
        doc='The Connectivity for which these measurements were made')
Esempio n. 13
0
class DualBrainViewerModel(ViewModel):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label='Time Series'
    )

    projection_surface = DataTypeGidAttr(
        linked_datatype=Surface,
        required=False,
        label='Projection Surface',
        doc='A surface on which to project the results. When missing, the first EEGCap is taken. '
            'This parameter is ignored when InternalSensors measures.'
    )

    shell_surface = DataTypeGidAttr(
        linked_datatype=Surface,
        required=False,
        label='Shell Surface',
        doc='Wrapping surface over the internal sensors, to be displayed '
            'semi-transparently, for visual purposes only.'
    )
Esempio n. 14
0
class FFTAdapterModel(ViewModel, fft.FFT):
    """
    Parameters have the following meaning:
    - time_series: the input time series to which the fft is to be applied
    - segment_length: the block size which determines the frequency resolution of the resulting power spectra
    - window_function: windowing functions can be applied before the FFT is performed
    - detrend: None; specify if detrend is performed on the time series
    """
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label="Time Series",
        doc="""The TimeSeries to which the FFT is to be applied.""")
Esempio n. 15
0
class RegionStimulusCreatorModel(ViewModel, StimuliRegion):
    temporal = Attr(field_type=TemporalApplicableEquation, label="Temporal Equation", default=PulseTrain())

    connectivity = DataTypeGidAttr(
        field_type=uuid.UUID,
        linked_datatype=Connectivity,
        label="Connectivity"
    )

    display_name = Str(
        label='Display name',
        required=False
    )
Esempio n. 16
0
class TimeseriesMetricsAdapterModel(ViewModel, BaseTimeseriesMetricAlgorithm):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label="Time Series",
        required=True,
        doc="The TimeSeries for which the metric(s) will be computed.")

    algorithms = List(
        of=str,
        choices=tuple(choices.values()),
        label='Selected metrics to be applied',
        doc=
        'The selected algorithms will all be applied on the input TimeSeries')
Esempio n. 17
0
class RegionMatTimeSeriesImporterModel(UploaderViewModel):
    data_file = Str(
        label='Please select file to import'
    )

    dataset_name = Attr(
        field_type=str,
        label='Matlab dataset name',
        doc='Name of the MATLAB dataset where data is stored'
    )

    structure_path = Attr(
        field_type=str,
        required=False,
        default='',
        label='For nested structures enter the field path (separated by .)'
    )

    transpose = Attr(
        field_type=bool,
        required=False,
        default=False,
        label='Transpose the array. Expected shape is (time, channel)'
    )

    slice = Attr(
        field_type=str,
        required=False,
        default='',
        label='Slice of the array in numpy syntax. Expected shape is (time, channel)'
    )

    sampling_rate = Attr(
        field_type=int,
        required=False,
        default=100,
        label='sampling rate (Hz)'
    )

    start_time = Attr(
        field_type=int,
        default=0,
        label='starting time (ms)'
    )

    datatype = DataTypeGidAttr(
        linked_datatype=Connectivity,
        label='Connectivity'
    )
Esempio n. 18
0
class ProjectionMatrixImporterModel(UploaderViewModel):
    projection_file = Str(
        label='Projection matrix file (.mat or .npy format)',
        doc='Expected a file containing projection matrix (one vector of length '
        'number of surface vertices nd values in the sensors range).')

    dataset_name = Attr(
        field_type=str,
        required=False,
        default=DEFAULT_DATASET_NAME,
        label='Matlab dataset name',
        doc=
        'Name of the MATLAB dataset where data is stored. Required only for .mat files'
    )

    surface = DataTypeGidAttr(
        linked_datatype=Surface,
        label='Brain Cortical Surface',
        doc='The Brain Surface used by the uploaded projection matrix.')

    sensors = DataTypeGidAttr(
        linked_datatype=Sensors,
        label='Sensors',
        doc='The Sensors used in for current projection.')
class CSVConnectivityImporterModel(UploaderViewModel):
    weights = Str(label='Weights file (csv)')

    weights_delimiter = EnumAttr(default=CSVDelimiterOptionsEnum.COMMA,
                                 label='Field delimiter : ')

    tracts = Str(label='Tracts file (csv)')

    tracts_delimiter = EnumAttr(default=CSVDelimiterOptionsEnum.COMMA,
                                label='Field delimiter : ')

    input_data = DataTypeGidAttr(
        linked_datatype=Connectivity,
        label=
        'Reference Connectivity Matrix (for node labels, 3d positions etc.)')
Esempio n. 20
0
class CSVConnectivityImporterModel(UploaderViewModel):
    weights = Str(label='Weights file (csv)')

    weights_delimiter = Str(choices=tuple(DELIMITER_OPTIONS.values()),
                            default=tuple(DELIMITER_OPTIONS.values())[0],
                            label='Field delimiter : ')

    tracts = Str(label='Tracts file (csv)')

    tracts_delimiter = Str(choices=tuple(DELIMITER_OPTIONS.values()),
                           default=tuple(DELIMITER_OPTIONS.values())[0],
                           label='Field delimiter : ')

    input_data = DataTypeGidAttr(
        linked_datatype=Connectivity,
        label=
        'Reference Connectivity Matrix (for node labels, 3d positions etc.)')
class BalloonModelAdapterModel(ViewModel):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeriesRegion,
        label="Time Series",
        required=True,
        doc="""The timeseries that represents the input neural activity"""
    )

    dt = Float(
        label=":math:`dt`",
        default=0.002,
        required=True,
        doc="""The integration time step size for the balloon model (s).
            If none is provided, by default, the TimeSeries sample period is used."""
    )

    neural_input_transformation = Attr(
        field_type=str,
        label="Neural input transformation",
        choices=("none", "abs_diff", "sum"),
        default="none",
        doc=""" This represents the operation to perform on the state-variable(s) of
            the model used to generate the input TimeSeries. ``none`` takes the
            first state-variable as neural input; `` abs_diff`` is the absolute
            value of the derivative (first order difference) of the first state variable; 
            ``sum``: sum all the state-variables of the input TimeSeries."""
    )

    bold_model = Attr(
        field_type=str,
        label="Select BOLD model equations",
        choices=("linear", "nonlinear"),
        default="nonlinear",
        doc="""Select the set of equations for the BOLD model."""
    )

    RBM = Attr(
        field_type=bool,
        label="Revised BOLD Model",
        default=True,
        required=True,
        doc="""Select classical vs revised BOLD model (CBM or RBM).
            Coefficients  k1, k2 and k3 will be derived accordingly."""
    )
Esempio n. 22
0
class WaveletAdapterModel(ViewModel):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label="Time Series",
        required=True,
        doc="""The timeseries to which the wavelet is to be applied.""")

    mother = Attr(
        field_type=str,
        label="Wavelet function",
        default="morlet",
        doc="""The mother wavelet function used in the transform. Default is
            'morlet', possibilities are: 'morlet'...""")

    sample_period = Float(
        label="Sample period of result (ms)",
        default=7.8125,  # 7.8125 => 128 Hz
        doc="""The sampling period of the computed wavelet spectrum. NOTE:
            This should be an integral multiple of the of the sampling period
            of the source time series, otherwise the actual resulting sample
            period will be the first correct value below that requested.""")

    frequencies = Attr(
        field_type=Range,
        label="Frequency range of result (kHz).",
        default=Range(lo=0.008, hi=0.060, step=0.002),
        doc="""The frequency resolution and range returned. Requested
            frequencies are converted internally into appropriate scales.""")

    normalisation = Attr(
        field_type=str,
        label="Normalisation",
        default="energy",
        doc="""The type of normalisation for the resulting wavet spectrum.
            Default is 'energy', options are: 'energy'; 'gabor'.""")

    q_ratio = Float(
        label="Q-ratio",
        default=5.0,
        doc=
        """NFC. Must be greater than 5. Ratios of the center frequencies to bandwidths."""
    )
class PearsonCorrelationCoefficientAdapterModel(ViewModel):
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label="Time Series",
        required=True,
        doc="""The time-series for which the cross correlation matrices are calculated."""
    )

    t_start = Float(
        label=":math:`t_{start}`",
        default=0.9765625,
        required=True,
        doc="""Time start point (ms). By default it uses the default Monitor sample period.
        The starting time point of a time series is not zero, but the monitor's sample period. """)

    t_end = Float(
        label=":math:`t_{end}`",
        default=1000.,
        required=True,
        doc=""" End time point (ms) """)
Esempio n. 24
0
class FFTAdapterModel(ViewModel):
    """
    Parameters have the following meaning:
    - time_series: the input time series to which the fft is to be applied
    - segment_length: the block size which determines the frequency resolution of the resulting power spectra
    - window_function: windowing functions can be applied before the FFT is performed
    - detrend: None; specify if detrend is performed on the time series
    """
    time_series = DataTypeGidAttr(
        linked_datatype=TimeSeries,
        label="Time Series",
        doc="""The TimeSeries to which the FFT is to be applied.""")

    segment_length = Float(
        label="Segment(window) length (ms)",
        default=1000.0,
        required=False,
        doc="""The TimeSeries can be segmented into equally sized blocks
            (overlapping if necessary). The segment length determines the
            frequency resolution of the resulting power spectra -- longer
            windows produce finer frequency resolution.""")

    window_function = Attr(
        field_type=str,
        label="Windowing function",
        choices=tuple(SUPPORTED_WINDOWING_FUNCTIONS),
        required=False,
        doc="""Windowing functions can be applied before the FFT is performed.
             Default is None, possibilities are: 'hamming'; 'bartlett';
            'blackman'; and 'hanning'. See, numpy.<function_name>.""")

    detrend = Attr(field_type=bool,
                   label="Detrending",
                   default=True,
                   required=False,
                   doc="""Detrending is not always appropriate.
            Default is True, False means no detrending is performed on the time series"""
                   )
Esempio n. 25
0
class NIFTIImporterModel(UploaderViewModel):
    data_file = Str(label='Please select file to import (gz or nii)')

    apply_corrections = Attr(
        field_type=bool,
        required=False,
        label='Apply auto Corrections',
        doc='Check this when the NII mapping has values outside [-1..N-1]. '
        'All outside range will be set -1 (background).')

    mappings_file = Str(
        required=False,
        label='Mapping File',
        doc=
        'Fill this for Region Mappings, when the indices in the NII do not match '
        'the Connectivity [0..N-1] indices')

    connectivity = DataTypeGidAttr(
        linked_datatype=Connectivity,
        required=False,
        label='Connectivity',
        doc='Optional Connectivity if the NII file is a volume2regions mapping'
    )
Esempio n. 26
0
    def get_filtered_datatypes(self, dt_module, dt_class, filters, has_all_option, has_none_option):
        """
        Given the name from the input tree, the dataType required and a number of
        filters, return the available dataType that satisfy the conditions imposed.
        """
        index_class = getattr(sys.modules[dt_module], dt_class)()
        filters_dict = json.loads(filters)

        for idx in range(len(filters_dict['fields'])):
            if filters_dict['values'][idx] in ['True', 'False']:
                filters_dict['values'][idx] = string2bool(filters_dict['values'][idx])

        filter = FilterChain(fields=filters_dict['fields'], operations=filters_dict['operations'],
                             values=filters_dict['values'])
        project = common.get_current_project()

        data_type_gid_attr = DataTypeGidAttr(linked_datatype=REGISTRY.get_datatype_for_index(index_class))
        data_type_gid_attr.required = not string2bool(has_none_option)

        select_field = TraitDataTypeSelectField(data_type_gid_attr, conditions=filter,
                                                has_all_option=string2bool(has_all_option))
        self.algorithm_service.fill_selectfield_with_datatypes(select_field, project.id)

        return {'options': select_field.options()}
Esempio n. 27
0
class BaseBCTModel(ViewModel):

    connectivity = DataTypeGidAttr(
        linked_datatype=Connectivity,
        label='Connectivity',
    )
Esempio n. 28
0
class ImaginaryCoherenceDisplayModel(ViewModel):
    input_data = DataTypeGidAttr(
        linked_datatype=ComplexCoherenceSpectrum,
        label='Complex Coherence Result',
        doc='Imaginary Coherence Analysis to display'
    )
Esempio n. 29
0
class CovarianceVisualizerModel(ViewModel):
    datatype = DataTypeGidAttr(
        linked_datatype=Covariance,
        label='Covariance'
    )
Esempio n. 30
0
class EEGMatTimeSeriesImporterModel(UploaderViewModel):
    datatype = DataTypeGidAttr(linked_datatype=Sensors, label='EEG Sensors')