Esempio n. 1
0
class RegionMatTimeSeriesImporterModel(UploaderViewModel):
    data_file = Str(label='Please select file to import')

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

    structure_path = 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 = Str(
        required=False,
        default='',
        label=
        'Slice of the array in numpy syntax. Expected shape is (time, channel)'
    )

    sampling_rate = Int(required=False,
                        default=100,
                        label='sampling rate (Hz)')

    start_time = Int(default=0, label='starting time (ms)')

    datatype = DataTypeGidAttr(linked_datatype=Connectivity,
                               label='Connectivity')
Esempio n. 2
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 GIFTISurfaceImporterModel(UploaderViewModel):
    KEY_OPTION_READ_METADATA = 'Specified in the file metadata'
    surface_types = ALL_SURFACES_SELECTION.copy()
    surface_types[KEY_OPTION_READ_METADATA] = OPTION_READ_METADATA

    file_type = Str(
        label='Specify file type : ',
        choices=tuple(surface_types.values()),
        default=tuple(surface_types.values())[0]
    )

    data_file = Str(
        label='Please select a .gii (LH if cortex)'
    )

    data_file_part2 = Str(
        required=False,
        label="Optionally select 2'nd .gii (RH if cortex)"
    )

    should_center = Attr(
        field_type=bool,
        required=False,
        default=False,
        label='Center surface using vertex means along axes'
    )
Esempio n. 4
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. 5
0
class ZIPConnectivityImporterModel(UploaderViewModel):
    uploaded = Str(label='Connectivity file (zip)')

    normalization = Str(required=False,
                        choices=tuple(NORMALIZATION_OPTIONS.values()),
                        label='Weights Normalization',
                        doc='Normalization mode for weights')
Esempio n. 6
0
 def __init__(self, choices):
     super(SimulatorPSEConfigurationFragment, self).__init__()
     default_choice = list(choices.values())[0]
     self.pse_param1 = SelectField(Str(default=default_choice,
                                       label="PSE param1"),
                                   choices=choices,
                                   name='pse_param1')
     self.pse_param2 = SelectField(Str(label="PSE param2", required=False),
                                   choices=choices,
                                   name='pse_param2')
Esempio n. 7
0
class ObjSurfaceImporterModel(UploaderViewModel):
    surface_type = Str(label='Specify file type :',
                       choices=tuple(ALL_SURFACES_SELECTION.values()),
                       default=tuple(ALL_SURFACES_SELECTION.values())[0])

    data_file = Str(label='Please select file to import')

    should_center = Attr(field_type=bool,
                         required=False,
                         default=False,
                         label='Center surface using vertex means along axes')
Esempio n. 8
0
class UploaderViewModel(ViewModel):
    REQUIRED_TYPE = None

    data_subject = Str(default=DataTypeMetaData.DEFAULT_SUBJECT,
                       label='Subject')

    encrypted_aes_key = Str(
        required=False,
        label='Encrypted AES Password (if your files come encrypted)',
        doc=
        'Check our demo notebook on how to produce this key and how we expect your files to be encrypted'
    )
class SensorsImporterModel(UploaderViewModel):
    OPTIONS = {
        'EEG Sensors': SensorsEEG.sensors_type.default,
        'MEG Sensors': SensorsMEG.sensors_type.default,
        'Internal Sensors': SensorsInternal.sensors_type.default
    }

    sensors_file = Str(
        label='Please upload sensors file (txt or bz2 format)',
        doc='Expected a text/bz2 file containing sensor measurements.')

    sensors_type = Str(label='Sensors type: ',
                       choices=tuple(OPTIONS.values()),
                       default=tuple(OPTIONS.values())[0])
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.)')
class ZIPSurfaceImporterModel(UploaderViewModel):
    uploaded = Str(label='Surface file (zip)')

    surface_type = Str(choices=tuple(ALL_SURFACES_SELECTION.values()),
                       default=tuple(ALL_SURFACES_SELECTION.values())[0],
                       label='Surface type')

    zero_based_triangles = Attr(field_type=bool,
                                required=False,
                                default=True,
                                label='Zero based triangles')

    should_center = Attr(field_type=bool,
                         required=False,
                         label='Center surface using vertex means along axes')
Esempio n. 12
0
class BRCOImporterModel(UploaderViewModel):
    data_file = Str(label='Connectivity Annotations')

    connectivity = DataTypeGidAttr(
        linked_datatype=Connectivity,
        label='Target Large Scale Connectivity',
        doc='The Connectivity for which these annotations were made')
Esempio n. 13
0
class UploaderViewModel(ViewModel):
    REQUIRED_TYPE = None

    data_subject = Str(
        default=DataTypeMetaData.DEFAULT_SUBJECT,
        label='Subject'
    )
 def __init__(self):
     super(_InputTreeFragment, self).__init__()
     self.dynamic_name = StrField(Str(
         label='Parameter configuration name',
         doc="""The name of this parameter configuration"""),
                                  self.project_id,
                                  name='dynamic_name')
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.'
    )
Esempio n. 16
0
class NetworkxImporterModel(UploaderViewModel):
    data_file = Str(label='Please select file to import')

    key_edge_weight = Attr(field_type=str,
                           required=False,
                           default=NetworkxParser.KEY_EDGE_WEIGHT[0],
                           label='Key Edge Weight')

    key_edge_tract = Attr(field_type=str,
                          required=False,
                          default=NetworkxParser.KEY_EDGE_TRACT[0],
                          label='Key Edge Tract')

    key_node_coordinates = Attr(field_type=str,
                                required=False,
                                default=NetworkxParser.KEY_NODE_COORDINATES[0],
                                label='Key Node Coordinates')

    key_node_label = Attr(field_type=str,
                          required=False,
                          default=NetworkxParser.KEY_NODE_LABEL[0],
                          label='Key Node Label')

    key_node_region = Attr(field_type=str,
                           required=False,
                           default=NetworkxParser.KEY_NODE_REGION[0],
                           label='Key Node Region')

    key_node_hemisphere = Attr(field_type=str,
                               required=False,
                               default=NetworkxParser.KEY_NODE_HEMISPHERE[0],
                               label='Key Node Hemisphere')
Esempio n. 17
0
class GIFTITimeSeriesImporterModel(UploaderViewModel):
    data_file = Str(label='Please select file to import (.gii)')

    surface = DataTypeGidAttr(
        linked_datatype=Surface,
        label='Brain Surface',
        doc='The Brain Surface used to generate imported TimeSeries.')
Esempio n. 18
0
    def test_hidden_field(self):
        hidden_str_attr = Str(label='Dummy Str', default='')
        hidden_field = HiddenField(hidden_str_attr, self.name)

        post_data = {'dummy_name': 'Dummy Hidden Str'}
        hidden_field.fill_from_post(post_data)
        assert hidden_field.data == post_data[self.name], "Hidden data was not set correctly on HiddenField!"
        assert hidden_field.label == '', "Hidden field should have empty label!"
Esempio n. 19
0
    def test_str_field_optional(self):
        str_attr = Str(label='Dummy Str', default='', required=False)
        str_field = StrField(str_attr, self.name)

        post_data = {'dummy_name': ''}
        str_field.fill_from_post(post_data)
        assert str_field.data == '', "Str data was not set correctly on StrField!"
        assert str_field.validate(), "Validation should not have failed on StrField!"
Esempio n. 20
0
 def _add_pse_field(self, param, param_key=KEY_PARAM1):
     # type: (RangeParameter, str) -> None
     pse_param_name = HiddenField(Str(default=param.name, required=False),
                                  self.NAME_FIELD.format(param_key))
     self.__setattr__(self.NAME_FIELD.format(param_key), pse_param_name)
     if param.type is float:
         self._add_fields_for_float(param, param_key)
     else:
         self._add_field_for_gid(param, param_key)
Esempio n. 21
0
    def test_upload_field(self):
        connectivity_file = os.path.join(os.path.dirname(tvb_data.__file__), 'connectivity', 'connectivity_96.zip')
        data_file = Str('Test Upload Field')
        required_type = '.zip'
        upload_field = TraitUploadField(data_file, required_type, self.name)

        post_data = {'Data_Subject': 'John Doe', self.name: connectivity_file, 'normalization': 'explicit-None-value'}
        upload_field.fill_from_post(post_data)

        assert post_data[self.name] == upload_field.data, "Path was not set correctly on TraitUploadField!"
Esempio n. 22
0
class LocalConnectivityCreatorModel(ViewModel, LocalConnectivity):
    surface = DataTypeGidAttr(
        linked_datatype=Surface,
        label=LocalConnectivity.surface.label
    )

    display_name = Str(
        label='Display name',
        required=False
    )
Esempio n. 23
0
class RegionStimulusCreatorModel(ViewModel, StimuliRegion):
    temporal = EnumAttr(field_type=TemporalEquationsEnum,
                        label="Temporal Equation",
                        default=TemporalEquationsEnum.PULSETRAIN.instance)

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

    display_name = Str(label='Display name', required=False)
Esempio n. 24
0
class TrackImporterModel(UploaderViewModel):
    data_file = Str(
        label='Please select file to import'
    )

    region_volume = DataTypeGidAttr(
        linked_datatype=RegionVolumeMapping,
        required=False,
        label='Reference Volume Map'
    )
Esempio n. 25
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. 26
0
class ObjSurfaceImporterModel(UploaderViewModel):
    surface_type = EnumAttr(label='Specify file type :',
                            default=SurfaceTypesEnum.CORTICAL_SURFACE)

    data_file = Str(label='Please select file to import')

    should_center = Attr(field_type=bool,
                         required=False,
                         default=False,
                         label='Center surface using vertex means along axes')
Esempio n. 27
0
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. 28
0
    def test_str_field_required(self):
        str_attr = Str(label='Dummy Str', default='')
        str_field = StrField(str_attr, self.name)

        post_data = {'dummy_name': 'dummy_str'}
        str_field.fill_from_post(post_data)
        assert str_field.data == post_data[self.name], "Str data was not set correctly on StrField!"

        post_data = {'dummy_name': ''}
        str_field.fill_from_post(post_data)
        assert str_field.validate() is False, "Validation should have failed on StrField!"
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. 30
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)