class GeoserviceSuggestionDataDTO(DTO): """DTO данных подсказки из геосервиса.""" fias_id = types.UUIDType() geo_lat = types.FloatType() geo_lon = types.FloatType() qc_geo = types.IntType(choices=GeoPointsAccuracy.choices()) fias_level = types.IntType()
class ComplexNumber(schema_utils.Model): """Represents a complex number. Attributes: real: The real part. imag: The imaginary part. """ real = types.FloatType(default=0.0) imag = types.FloatType(default=0.0)
class UniformInitializer(Initializer): """Initializes parametrization uniformly at random. The parametrization values are initialized element-wise. Attributes: min_val: Minimum value of distribution. max_val: Maximum value of distribution. """ type = schema_utils.polymorphic_model_type("initializer.uniform_random") min_val = types.FloatType() max_val = types.FloatType()
class NormalInitializer(Initializer): """Initializes parametrization using normal distribution. The parametrization values are initialized element-wise by a normal distribution. Attributes: mean: Mean value of the normal distribution. std: Standard deviation value of the normal distribution. """ type = schema_utils.polymorphic_model_type("initializer.normal") mean = types.FloatType() std = types.FloatType()
class PowerComp(optplan.Function): """Defines a penalty function to check if a function is in a certain range. penalty = R(f-(value-range/2))**exp+R((value-range/2)-f), where R is a ramp function. Attributes: type: Must be "function.power_comp". """ type = schema_utils.polymorphic_model_type("function.power_comp") function = optplan.ReferenceType(optplan.Function) value = types.FloatType() range = types.FloatType() exp = types.FloatType()
class WaveguideInitializer3(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 extent_frac_x: extent_frac_y: center_frac_x: center_frac_y: """ type = schema_utils.polymorphic_model_type("initializer.waveguide_3") lower_min = types.FloatType() lower_max = types.FloatType() upper_min = types.FloatType() upper_max = types.FloatType() extent_frac_x = types.FloatType() extent_frac_y = types.FloatType() center_frac_x = types.FloatType() center_frac_y = types.FloatType()
class AddressDTO(DTO): """DTO адреса.""" id = types.IntType() # noqa: A003 city = types.StringType(required=True) street = types.StringType(required=True) house = types.StringType(required=True) building = types.StringType() apartment = types.StringType() floor = types.StringType() entrance = types.StringType() comment = types.StringType() lat = types.FloatType() lon = types.FloatType() fias_id = types.UUIDType()
class DipoleSource(optplan.EmSource): """Represents a dipole source. Attributes: position: Position of the dipole (will snap to grid). axis: Direction of the dipole (x:0, y:1, z:2). phase: Phase of the dipole source (in radian). power: Power assuming uniform dielectric space with the permittivity. """ type = schema_utils.polymorphic_model_type("source.dipole_source") position = optplan.vec3d() axis = types.IntType() phase = types.FloatType() power = types.FloatType() normalize_by_sim = types.BooleanType(default=False)
class GratingFeatureConstraint(optplan.Function): """Defines a feature constraint on `GratingParametrization`. Args: simulation_space: Used to extract the number of pixels in the design region. min_feature_size: Minimum feature size in nm. boundary_constraint_scale: See `spins.invdes.problem.GratingConstraint` for details. """ type = schema_utils.polymorphic_model_type( "function.grating_feature_constraint") simulation_space = optplan.ReferenceType(optplan.SimulationSpaceBase) min_feature_size = types.FloatType() boundary_constraint_scale = types.FloatType(default=2.0)
class PlaneWaveSource(optplan.EmSource): """Represents a plane wave source. Attributes: type: Must be "source.plane_wave". """ type = schema_utils.polymorphic_model_type("source.plane_wave") center = optplan.vec3d() extents = optplan.vec3d() normal = optplan.vec3d() theta = types.FloatType() psi = types.FloatType() polarization_angle = types.FloatType() overwrite_bloch_vector = types.BooleanType() border = types.ListType(types.FloatType()) power = types.FloatType()
class Parameter(optplan.Function): """Defines a constant scalar. Attributes: type: Must be "function.parameter". initial value: Value of the parameters when it is initialized. """ type = schema_utils.polymorphic_model_type("function.parameter") initial_value = types.FloatType()
class UniformMesh(schema_utils.Model): """Defines a uniform mesh. Attributes: type: Must be "uniform". dx: Unit cell distance for EM grid (nm). """ type = schema_utils.polymorphic_model_type("uniform") dx = types.FloatType()
class IndicatorPlus(optplan.Function): """Defines a penalty function to check if a function is above some value penalty = (obj>alpha)*(obj - alpha)**power """ type = schema_utils.polymorphic_model_type("function.indicator_plus") function = optplan.ReferenceType(optplan.Function) alpha = types.FloatType() power = types.IntType()
class GaussianSource(optplan.EmSource): """Represents a gaussian source. Attributes: type: Must be "source.gaussian_beam". normalize_by_sim: If `True`, normalize the power by running a simulation. """ type = schema_utils.polymorphic_model_type("source.gaussian_beam") w0 = types.FloatType() center = optplan.vec3d() extents = optplan.vec3d() normal = optplan.vec3d() theta = types.FloatType() psi = types.FloatType() polarization_angle = types.FloatType() overwrite_bloch_vector = types.BooleanType() power = types.FloatType() normalize_by_sim = types.BooleanType(default=False)
class PenaltyOptimizerOptions(schema_utils.Model): """Defines an optimizer carried out by `PenaltyOptimizer`. Attributes: mu0: initial mu, i.e. the weight factor for the penalty term. tau: exponent by which mu is increased. pf: exponent over the penalty function. num_cycles: number of suboptimization with an increased mu. ftol: (As explained in the scipy minimize documentation) gtol: (As explained in the scipy minimize documentation) maxiter: maximum iteration in one suboptimization. """ mu0 = types.FloatType() tau = types.FloatType() pf = types.FloatType() num_cycles = types.IntType() maxiter = types.IntType() ftol = types.FloatType() gtol = types.FloatType()
class FdfdSimulation(optplan.Function): """Defines a FDFD simulation. Attributes: type: Must be "function.fdfd_simulation". name: Name of simulation. simulation_space: Simulation space name. source: Source name. wavelength: Wavelength at which to simulate. solver: Name of solver to use. bloch_vector: bloch optplan.vector at which to simulate. """ type = schema_utils.polymorphic_model_type("function.fdfd_simulation") simulation_space = optplan.ReferenceType(optplan.SimulationSpaceBase) epsilon = optplan.ReferenceType(optplan.Function) source = optplan.ReferenceType(optplan.EmSource) wavelength = types.FloatType() solver = types.StringType(choices=("maxwell_bicgstab", "maxwell_cg", "local_direct")) bloch_vector = types.ListType(types.FloatType())
class Power(optplan.Function): """Defines the power of a function. Attributes: type: Must be "power". function: Function to take power of. exp: Power. """ type = schema_utils.polymorphic_model_type("function.power") function = optplan.ReferenceType(optplan.Function) exp = types.FloatType()
class GratingFeatureConstraint(optplan.Function): """Defines a feature constraint on `GratingParametrization`. Args: simulation_space: Used to extract the number of pixels in the design region. min_feature_size: Minimum feature size in nm. """ type = schema_utils.polymorphic_model_type( "function.grating_feature_constraint") simulation_space = optplan.ReferenceType(optplan.SimulationSpaceBase) min_feature_size = types.FloatType()
class WaveguideInitializer2(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_2") lower_min = types.FloatType() lower_max = types.FloatType() upper_min = types.FloatType() upper_max = types.FloatType() sim_space = optplan.ReferenceType(optplan.SimulationSpace) region = optplan.ReferenceType(optplan.EmRegion)
class ScipyOptimizerOptions(schema_utils.Model): """Defines an optimizer carried out by `ScipyOptimizer`. Attributes: tol: (As explained in the scipy minimize documentation) maxcor: (As explained in the scipy minimize documentation) ftol: (As explained in the scipy minimize documentation) gtol: (As explained in the scipy minimize documentation) eps: (As explained in the scipy minimize documentation) maxfun: (As explained in the scipy minimize documentation) maxiter: (As explained in the scipy minimize documentation) maxls: (As explained in the scipy minimize documentation) """ tol = types.FloatType() maxcor = types.IntType() ftol = types.FloatType() gtol = types.FloatType() eps = types.FloatType() maxfun = types.IntType() maxiter = types.IntType() maxls = types.IntType()
class ParamEps(EpsilonSpec): """Defines a permittivity distribution based on a parametriation. Attributes: type: Must be "parametrization". parametrization: Name of the parametrization. simulation_space: Name of the simulation space. wavelength: Wavelength. """ type = schema_utils.polymorphic_model_type("parametrization") parametrization = optplan.ReferenceType(optplan.Parametrization) simulation_space = optplan.ReferenceType(optplan.SimulationSpaceBase) wavelength = types.FloatType()
class Epsilon(optplan.Function): """Defines a Epsilon Grid. Attributes: type: Must be "function.epsilon". name: Name of epsilon. simulation_space: Simulation space name. wavelength: Wavelength at which to calculate epsilon. """ type = schema_utils.polymorphic_model_type("function.epsilon") simulation_space = optplan.ReferenceType(optplan.SimulationSpaceBase) wavelength = types.FloatType() structure = optplan.ReferenceType(optplan.Parametrization)
class CubicParamSigmoidStrength(optplan.TransformationBase): """Changes the strength of the sigmoid function in `CubicParametrization`. `CubicParametrization` applies a sigmoid function after cubic interpolation to make the structure more discrete. This transformation changes the parameter in the sigmoid function, effectively changing how discrete the structure becomes. In the limit as the value tends to infinity, the sigmoid function becomes a step function (i.e. perfectly discrete structure). Attributes: value: Value for sigmoid function. """ type = schema_utils.polymorphic_model_type("cubic_param.sigmoid_strength") value = types.FloatType(default=4)
class KerrOverlap(optplan.EmOverlap): """Represents the area in which we want to have a strong Kerr nonlinearity Effectively just the epsilon value in the desired region. Attributes: center: Optimization area center extents: Width and height of the optimization region power: The transmission power of the mode. """ type = schema_utils.polymorphic_model_type("overlap.kerr") center = optplan.vec3d() extents = optplan.vec3d() power = types.FloatType()
class FabricationConstraint(optplan.Function): """Defines fabrication constraint penalty function. Attributes: type: Must be "function.fabrication_constraint" minimum_curvature_diameter: Smallest allowed curvature. minimum_gap: Smallest allowed gap. simulation_space: Simulation space where the fabrication constraint is evaluated. oversample: Oversample the fine grid by this value to evaluate the penalty. method: gap: only applies the gap constraint, curv: only apply the curvature constraint, gapAndCurve: apply the gap and curvature constraint. apply_weights: To meet the constraint you typically need to go for a slightly more stringent gap and curvature values. If true then weigth factor are applied that take care of this.(default: True) """ type = schema_utils.polymorphic_model_type( "function.fabrication_constraint") minimum_curvature_diameter = types.FloatType() minimum_gap = types.FloatType() simulation_space = optplan.ReferenceType(optplan.SimulationSpaceBase) method = types.StringType(choices=("gap", "curv", "gap_and_curve")) apply_factors = types.BooleanType()
class Region(optplan.EmRegion): """Represents the area in which we want to consider the objective function Effectively just the epsilon value in the desired region. Attributes: center: Optimization area center extents: Width and height of the optimization region power: Multiplier for the effects of the objective function (default 1). """ type = schema_utils.polymorphic_model_type("overlap.region") center = optplan.vec3d() extents = optplan.vec3d() power = types.FloatType()
class Refund(models.Model): original_payment_reference = types.StringType( serialized_name='originalPaymentReference') amount = types.FloatType() currency = types.StringType() message = types.StringType() payer_alias = types.StringType(serialized_name='payerAlias') payee_alias = types.StringType(serialized_name='payeeAlias') callback_url = types.URLType(serialized_name='callbackUrl') payer_payment_reference = types.StringType( serialized_name='payerPaymentReference') payment_reference = types.StringType(serialized_name='paymentReference') class Options: serialize_when_none = False
class Route(models.Model): ''' Route ''' # default '*' means all destinations dst = types.StringType(default='*') destination = types.StringType(default='*') channel = types.StringType(required=True) dstchannel = types.StringType(required=True) destination_channel = types.StringType(required=True) cost = types.FloatType(required=True)
class ContToDiscThresholding(optplan.TransformationBase): """Defines a transformation that takes a continuous parametrization and thresholds it at a value. Attributes: type: Must be "cont_to_disc_thresholding". value: Threshold value. Note that this requests requires the parametrization to have the same parametrization vector size, e.g. cubic to bicubic or hermiteparam to hermitelevelset. """ type = schema_utils.polymorphic_model_type("cont_to_disc_thresholding") continuous_parametrization = optplan.ReferenceType(optplan.Parametrization) threshold = types.FloatType()
class GratingEdgeFitTransformation(optplan.TransformationBase): """Defines the discretization procedure for gratings. Specifically, this will convert any epsilon description into a `GratingEdgeParametrization`. Attributes: parametrization: Parametrization to match structure to. min_feature: Minimum feature size in terms of number of pixels. Can be fractional. """ type = schema_utils.polymorphic_model_type( "grating_edge_fit_transformation") parametrization = optplan.ReferenceType(optplan.Parametrization) min_feature = types.FloatType()