Esempio n. 1
0
 def __init__(self, prefix=''):
     super(RangeForm, self).__init__(prefix)
     self.lo = SimpleFloatField(self, name='lo', required=True, label='Lo', doc='start of range')
     # default=ContinuousWaveletTransform.frequencies.lo)
     self.step = SimpleFloatField(self, name='step', required=True, label='Step', doc='step of range')
     # default=ContinuousWaveletTransform.frequencies.step)
     self.hi = SimpleFloatField(self, name='hi', required=True, label='Hi', doc='end of range')
class EquationPlotForm(Form):
    def __init__(self):
        super(EquationPlotForm, self).__init__()
        self.min_x = SimpleFloatField(
            self,
            name='min_x',
            label='Min distance(mm)',
            doc="The minimum value of the x-axis for spatial equation plot.",
            default=0)
        self.max_x = SimpleFloatField(
            self,
            name='max_x',
            label='Max distance(mm)',
            doc="The maximum value of the x-axis for spatial equation plot.",
            default=100)

    def fill_from_post(self, form_data):
        if self.min_x.name in form_data:
            self.min_x.fill_from_post(form_data)
        if self.max_x.name in form_data:
            self.max_x.fill_from_post(form_data)

    @using_template('form_fields/form')
    def __str__(self):
        return {'form': self}
Esempio n. 3
0
 def __init__(self):
     super(EquationTemporalPlotForm, self).__init__()
     self.min_tmp_x = SimpleFloatField(self, name='min_tmp_x', label='Temporal Start Time(ms)', default=0,
                                       doc="The minimum value of the x-axis for temporal equation plot. "
                                           "Not persisted, used only for visualization.")
     self.max_tmp_x = SimpleFloatField(self, name='max_tmp_x', label='Temporal End Time(ms)', default=100,
                                       doc="The maximum value of the x-axis for temporal equation plot. "
                                           "Not persisted, used only for visualization.")
Esempio n. 4
0
class EquationSpatialPlotForm(Form):
    def __init__(self):
        super(EquationSpatialPlotForm, self).__init__()
        self.min_space_x = SimpleFloatField(self, name='min_space_x', label='Spatial Start Distance(mm)', default=0,
                                            doc="The minimum value of the x-axis for spatial equation plot.")
        self.max_space_x = SimpleFloatField(self, name='max_space_x', label='Spatial End Distance(mm)', default=100,
                                            doc="The maximum value of the x-axis for spatial equation plot.")

    def fill_from_post(self, form_data):
        if self.min_space_x.name in form_data:
            self.min_space_x.fill_from_post(form_data)
        if self.max_space_x.name in form_data:
            self.max_space_x.fill_from_post(form_data)
Esempio n. 5
0
 def __init__(self):
     super(EquationPlotForm, self).__init__()
     self.min_x = SimpleFloatField(
         self,
         name='min_x',
         label='Min distance(mm)',
         doc="The minimum value of the x-axis for spatial equation plot.",
         default=0)
     self.max_x = SimpleFloatField(
         self,
         name='max_x',
         label='Max distance(mm)',
         doc="The maximum value of the x-axis for spatial equation plot.",
         default=100)
 def __init__(self):
     super(EquationSpatialPlotForm, self).__init__()
     self.min_space_x = SimpleFloatField(
         self,
         name='min_space_x',
         label='Spatial Start Distance(mm)',
         default=0,
         doc="The minimum value of the x-axis for spatial equation plot.")
     self.max_space_x = SimpleFloatField(
         self,
         name='max_space_x',
         label='Spatial End Distance(mm)',
         default=100,
         doc="The maximum value of the x-axis for spatial equation plot.")
Esempio n. 7
0
class EquationTemporalPlotForm(Form):
    def __init__(self):
        super(EquationTemporalPlotForm, self).__init__()
        self.min_tmp_x = SimpleFloatField(self, name='min_tmp_x', label='Temporal Start Time(ms)', default=0,
                                          doc="The minimum value of the x-axis for temporal equation plot. "
                                              "Not persisted, used only for visualization.")
        self.max_tmp_x = SimpleFloatField(self, name='max_tmp_x', label='Temporal End Time(ms)', default=100,
                                          doc="The maximum value of the x-axis for temporal equation plot. "
                                              "Not persisted, used only for visualization.")

    def fill_from_post(self, form_data):
        if self.min_tmp_x.name in form_data:
            self.min_tmp_x.fill_from_post(form_data)
        if self.max_tmp_x.name in form_data:
            self.max_tmp_x.fill_from_post(form_data)
Esempio n. 8
0
 def _add_fields_for_float(self, param, param_key):
     # type: (RangeParameter, str) -> None
     pse_param_lo = SimpleFloatField(self,
                                     name=self.LO_FIELD.format(param_key),
                                     required=True,
                                     label='LO for {}'.format(param.name),
                                     default=param.range_definition.lo)
     self.__setattr__(self.LO_FIELD.format(param_key), pse_param_lo)
     pse_param_hi = SimpleFloatField(self,
                                     name=self.HI_FIELD.format(param_key),
                                     required=True,
                                     label='HI for {}'.format(param.name),
                                     default=param.range_definition.hi)
     self.__setattr__(self.HI_FIELD.format(param_key), pse_param_hi)
     pse_param_step = SimpleFloatField(
         self,
         name=self.STEP_FIELD.format(param_key),
         required=True,
         label='STEP for {}'.format(param.name),
         default=param.range_definition.step)
     self.__setattr__(self.STEP_FIELD.format(param_key), pse_param_step)
Esempio n. 9
0
    def __init__(self, pse_param1, pse_param2, prefix='', project_id=None):
        # type: (RangeParameter) -> None
        super(SimulatorPSEParamRangeFragment, self).__init__(prefix, project_id)
        self.pse_param1_name = SimpleHiddenField(self, name='pse_param1_name', default=pse_param1.name)
        if pse_param1.type is float:
            self.pse_param1_lo = SimpleFloatField(self, name='pse_param1_lo', required=True, label='pse_param1_lo',
                                                  default=pse_param1.range_definition.lo)
            self.pse_param1_hi = SimpleFloatField(self, name='pse_param1_hi', required=True, label='pse_param1_hi',
                                                  default=pse_param1.range_definition.hi)
            self.pse_param1_step = SimpleFloatField(self, name='pse_param1_step', required=True,
                                                    label='pse_param1_step', default=pse_param1.range_definition.step)

        else:
            self.pse_param1_dt = DataTypeSelectField(h5.REGISTRY.get_index_for_datatype(pse_param1.type), self,
                                                     name='pse_param1', required=True, label='pse_param1',
                                                     dynamic_conditions=pse_param1.range_definition,
                                                     has_all_option=True)

        if pse_param2:
            self.pse_param2_name = SimpleHiddenField(self, name='pse_param2_name', default=pse_param2.name)
            if pse_param2.type is float:
                self.pse_param2_lo = SimpleFloatField(self, name='pse_param2_lo', required=True, label='pse_param2_lo',
                                                      default=pse_param2.range_definition.lo)
                self.pse_param2_hi = SimpleFloatField(self, name='pse_param2_hi', required=True, label='pse_param2_hi',
                                                      default=pse_param2.range_definition.hi)
                self.pse_param2_step = SimpleFloatField(self, name='pse_param2_step', required=True,
                                                        label='pse_param2_step',
                                                        default=pse_param2.range_definition.step)
            else:
                self.pse_param2_dt = DataTypeSelectField(h5.REGISTRY.get_index_for_datatype(pse_param2.type), self,
                                                         name='pse_param2', required=True, label='pse_param2',
                                                         dynamic_conditions=pse_param2.range_definition,
                                                         has_all_option=True)
Esempio n. 10
0
 def __init__(self, prefix=''):
     super(EquationForm, self).__init__(prefix)
     self.equation = ScalarField(self.get_traited_equation().equation,
                                 self,
                                 disabled=True)
     for param_key, param in self.get_traited_equation().parameters.default(
     ).items():
         setattr(
             self, param_key,
             SimpleFloatField(self,
                              param_key,
                              required=True,
                              label=param_key,
                              default=param))
Esempio n. 11
0
    def __init__(self, prefix='', project_id=None):
        super(ConnectivityViewerForm, self).__init__(prefix, project_id)

        # filters_ui = [UIFilter(linked_elem_name="colors",
        #                        linked_elem_field=FilterChain.datatype + "._connectivity"),
        #               UIFilter(linked_elem_name="rays",
        #                        linked_elem_field=FilterChain.datatype + "._connectivity")]
        # json_ui_filter = json.dumps([ui_filter.to_dict() for ui_filter in filters_ui])
        # KWARG_FILTERS_UI: json_ui_filter

        self.connectivity = DataTypeSelectField(self.get_required_datatype(),
                                                self,
                                                name='input_data',
                                                required=True,
                                                label='Connectivity Matrix',
                                                conditions=self.get_filters())
        surface_conditions = FilterChain(
            fields=[FilterChain.datatype + '.surface_type'],
            operations=["=="],
            values=['Cortical Surface'])
        self.surface_data = DataTypeSelectField(
            SurfaceIndex,
            self,
            name='surface_data',
            label='Brain Surface',
            doc=
            'The Brain Surface is used to give you an idea of the connectivity '
            'position relative to the full brain cortical surface. This surface'
            ' will be displayed as a shadow (only used in 3D Edges tab).',
            conditions=surface_conditions)

        self.step = SimpleFloatField(
            self,
            name='step',
            label='Color Threshold',
            doc=
            'All nodes with a value greater or equal (>=) than this threshold will be '
            'displayed as red discs, otherwise (<) they will be yellow. (This applies to '
            '2D Connectivity tabs and the threshold will depend on the metric used to set '
            'the Node Color)')

        colors_conditions = FilterChain(
            fields=[FilterChain.datatype + '.ndim'],
            operations=["=="],
            values=[1])
        self.colors = DataTypeSelectField(
            ConnectivityMeasureIndex,
            self,
            name='colors',
            conditions=colors_conditions,
            label='Node Colors',
            doc='A ConnectivityMeasure DataType that establishes a '
            'colormap for the nodes displayed in the 2D '
            'Connectivity tabs.')

        rays_conditions = FilterChain(fields=[FilterChain.datatype + '.ndim'],
                                      operations=["=="],
                                      values=[1])
        self.rays = DataTypeSelectField(
            ConnectivityMeasureIndex,
            self,
            name='rays',
            conditions=rays_conditions,
            label='Shapes Dimensions',
            doc='A ConnectivityMeasure datatype used to establish '
            'the size of the spheres representing each node. '
            '(It only applies to 3D Nodes tab).')