예제 #1
0
    def update_data(self, **kwargs):
        self.s_data = []
        self.t_data = []
        self.field_data = []

        osp = self.opt_model.optical_spec
        _, wvl, foc = osp.lookup_fld_wvl_focus(0)
        fld = Field()
        max_field = osp.field_of_view.max_field()[0]
        for f in np.linspace(0., max_field, num=21):
            fld.y = f
            s_foc, t_foc = self.eval_fct(self.opt_model, fld, wvl, foc)
            self.s_data.append(s_foc)
            self.t_data.append(t_foc)
            self.field_data.append(f)
예제 #2
0
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)
예제 #3
0
def field_spec_data(optm, cmd, inputs):
    # XFLN 0 0 0 0 0 0 0 0 0 0 0 0
    # YFLN 0 8.0 1.36E+1 0 0 0 0 0 0 0 0 0
    # FWGN 1 1 1 1 1 1 1 1 1 1 1 1
    # VDXN 0 0 0 0 0 0 0 0 0 0 0 0
    # VDYN 0 0 0 0 0 0 0 0 0 0 0 0
    # VCXN 0 0 0 0 0 0 0 0 0 0 0 0
    # VCYN 0 0 0 0 0 0 0 0 0 0 0 0
    # VANN 0 0 0 0 0 0 0 0 0 0 0 0

    # older files (perhaps?)
    # XFLD 0 0 0
    # YFLD 0 35 50
    # FWGT 1 1 1
    global _track_contents

    fov = optm.optical_spec.field_of_view
    if cmd == 'XFLN' or cmd == 'YFLN' or cmd == 'XFLD' or cmd == 'YFLD':
        attr = cmd[0].lower()
    elif cmd == 'FTYP':
        ftyp = int(inputs.split()[0])
        _track_contents["FTYP"] = inputs
        if ftyp == 0:
            fov.key = 'field', 'object', 'angle'
        elif ftyp == 1:
            fov.key = 'field', 'object', 'height'
        elif ftyp == 2:
            fov.key = 'field', 'image', 'height'
        elif ftyp == 3:
            fov.key = 'field', 'image', 'height'
        return True
    elif cmd == 'VDXN' or cmd == 'VDYN':
        attr = 'vd' + cmd[2].lower()
    elif cmd == 'VCXN' or cmd == 'VCYN':
        attr = 'vc' + cmd[2].lower()
    elif cmd == 'VANN':
        attr = 'van'
    elif cmd == 'FWGN' or cmd == 'FWGT':
        attr = 'wt'
    else:
        return False

    inputs = inputs.split()

    if len(fov.fields) != len(inputs):
        fov.fields = [Field() for f in range(len(inputs))]

    for i, f in enumerate(fov.fields):
        f.__setattr__(attr, float(inputs[i]))

    log_cmd("field_spec_data", cmd, inputs)

    return True
예제 #4
0
def field_spec_data(optm, tla, qlist, dlist):
    fov = optm.optical_spec.field_of_view
    if tla == 'XOB' or tla == 'YOB':
        fov.key = 'field', 'object', 'height'
    elif tla == 'XAN' or tla == 'YAN':
        fov.key = 'field', 'object', 'angle'
    elif tla == 'XIM' or tla == 'YIM':
        fov.key = 'field', 'image', 'height'

    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)