Pointing.py 2.86 KB
Newer Older
1
2
3
4
import numpy as np
import galsim
from astropy.time import Time

5
6
import ObservationSim.Instrument._util as _util

7
class Pointing(object):
8
    def __init__(self, id=0, ra=0., dec=0., img_pa=0., timestamp=1621915200, sat_x=0., sat_y=0., sat_z=0., sun_x=0., sun_y=0., sun_z=0., sat_vx=0., sat_vy=0., sat_vz=0., exp_time=150., pointing_type='SCI'):
9
10
11
12
13
14
        self.id = id
        self.ra = ra
        self.dec = dec
        self.img_pa = img_pa * galsim.degrees
        self.timestamp = timestamp
        self.sat_x, self.sat_y, self.sat_z = sat_x, sat_y, sat_z
15
        self.sun_x, self.sun_y, self.sun_z = sun_x, sun_y, sun_z
16
17
18
        self.sat_vx, self.sat_vy, self.sat_vz = sat_vx, sat_vy, sat_vz
        self.exp_time = exp_time
        self.pointing_type = pointing_type
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
        self.survey_field_type = 'WIDE'
        self.jdt = 0. 
    
    def get_full_depth_exptime(self, filter_type):
        if self.survey_field_type == 'WIDE':
            if filter_type in _util.SPEC_FILTERS:
                return 150. * 4
            else:
                if filter_type.lower() in ['nuv', 'y']:
                    return 150. * 4
                elif filter_type.lower() in ['u', 'g', 'r', 'i', 'z']:
                    return 150. * 2
                else:
                    return max(150., self.exp_time) # [TODO] for FGS
        elif self.survey_field_type == 'DEEP':
            if filter_type in _util.SPEC_FILTERS:
                return 250. * 4 * 4
            else:
                if filter_type.lower() in ['nuv', 'y']:
                    return 250. * 4 * 4
                elif filter_type.lower() in ['u', 'g', 'r', 'i', 'z']:
                    return 250. * 2 * 4
                else:
                    return max(150., self.exp_time) # [TODO] for FGS

44

45
    def read_pointing_columns(self, columns, id=0, t=1621915200, pointing_type='SCI'):
46
47
48
49
50
51
52
53
54
        self.id = id
        col_len = len(columns)
        self.ra = float(columns[0])
        self.dec = float(columns[1])
        self.img_pa = float(columns[4]) * galsim.degrees
        self.pointing_type = pointing_type
        if col_len > 5:
            jdt = np.double(columns[5])
            t_temp = Time(jdt, format='jd')
55
            self.jdt = jdt
56
57
58
59
            self.timestamp = t_temp.unix
            self.sat_x = float(columns[6])
            self.sat_y = float(columns[7])
            self.sat_z = float(columns[8])
60
61
            self.sun_x = float(columns[9])
            self.sun_y = float(columns[10])
62
            self.sun_z = float(columns[11])
63
64
65
66
            self.sat_vx = float(columns[15])
            self.sat_vy = float(columns[16])
            self.sat_vz = float(columns[17])
            self.exp_time = float(columns[18])
67
68
69
70
            is_deep = float(columns[19])
            # [TODO] Can also define other survey types
            if is_deep != -1.0:
                self.survey_field_type = "DEEP"
71
72
        else:
            self.timestamp = t