def field_spec_data(optm, tla, qlist, dlist): fov = optm.optical_spec.field_of_view if tla == 'XOB' or tla == 'YOB': field_type = FieldType.OBJ_HT elif tla == 'XAN' or tla == 'YAN': field_type = FieldType.OBJ_ANG elif tla == 'XIM' or tla == 'YIM': field_type = FieldType.IMG_HT else: field_type = None if field_type: fov.key = model_enums.get_fld_key_for_type(field_type) if len(fov.fields) != len(dlist): fov.fields = [Field() for f in range(len(dlist))] if tla[0] == 'V': attr = tla.lower() elif tla[0] == 'X' or tla[0] == 'Y': attr = tla[0].lower() elif tla == 'WTF': attr = 'wt' for i, f in enumerate(fov.fields): f.__setattr__(attr, dlist[i]) log_cmd("field_spec_data", tla, qlist, dlist)
def sync_to_restore(self, optical_spec): if hasattr(self, 'field_type'): self.key = model_enums.get_fld_key_for_type(self.field_type) del self.field_type if not hasattr(self, 'is_relative'): self.is_relative = False if not hasattr(self, 'value'): self.value, _ = self.max_field() self.optical_spec = optical_spec
def mutate_field_type(self, new_field_type): osp = self.optical_spec fld_key = model_enums.get_fld_key_for_type(new_field_type) field, obj_img_key, value_key = fld_key if self.optical_spec is not None: if osp.parax_data is not None: fod = self.optical_spec.parax_data.fod if obj_img_key == 'object': if value_key == 'height': self.value = osp.parax_data.pr_ray[0][mc.ht] elif value_key == 'angle': self.value = fod.obj_ang elif obj_img_key == 'image': if value_key == 'height': self.value = fod.img_ht self.key = fld_key
def sync_to_restore(self, optical_spec): if hasattr(self, 'field_type'): self.key = model_enums.get_fld_key_for_type(self.field_type) del self.field_type self.optical_spec = optical_spec