Ejemplo n.º 1
0
class StatusSettings(Model):
    """The settings of a status column

    __________
    Properties

        labels : `str`
            The index / label parings of a status column option.
        labels_colors : `dict`
            The index / color property parings of a status column option.
        labels_positions_v2 : `dict`
            The position of each label by ID.

    _______
    Methods

        get_index : `str`
            Get the label ID from the label value.
    """

    labels = types.DictType(types.StringType())
    labels_colors = types.DictType(types.DictType(types.StringType()))
    labels_positions_v2 = types.DictType(types.StringType())
    done_colors = types.ListType(types.IntType())
    hide_footer = types.BooleanType(default=False)

    def __repr__(self):
        return str(self.to_primitive())

    def get_index(self, label: str):
        """Get the label ID from the label value.

        __________
        Parameters

            label : `str`
                The status column option label value.

        _______
        Returns

            index : `int`
                The id of the status column option.
        """

        for key, value in dict(self.labels).items():
            if value == label:
                return int(key)
        return None

    def __getitem__(self, index: int):
        return dict(self.labels)[str(index)]
Ejemplo n.º 2
0
class WaveguideInitializer(Initializer):
    """Initializes parametrization using with a rectangular epsilon shape.

    The two levels of the step function can optionally have uniformly random
    initialization.

    Attributes:
        lower_min: minimum value of the lower (background) permittivity
        lower_max: maximum value of the lower (background) permittivity
        upper_min: minimum value of the upper (waveguide) permittivity
        upper_max: maximum value of the upper (waveguide) permittivity
        region: optplan.Region object specifying the upper permittivity (waveguide) region
        sim_space: simulation object to use to generate the waveguide region
    """
    type = schema_utils.polymorphic_model_type("initializer.waveguide")
    lower_min = types.FloatType()
    lower_max = types.FloatType()
    upper_min = types.FloatType()
    upper_max = types.FloatType()
    center = optplan.vec3d()
    extents = optplan.vec3d()
    edge_coords = types.ListType(types.ListType(types.IntType))