prepare_headers.py 1.86 KB
Newer Older
Fang Yuedong's avatar
Fang Yuedong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from observation_sim.config.header import generatePrimaryHeader, generateExtensionHeader


def prepare_headers(self, chip, pointing):
    self.h_prim = generatePrimaryHeader(
        xlen=chip.npix_x,
        ylen=chip.npix_y,
        pointing_id=pointing.obs_id,
        pointing_type_code=pointing.pointing_type_code,
        ra=pointing.ra,
        dec=pointing.dec,
        pixel_scale=chip.pix_scale,
        time_pt=pointing.timestamp,
        exptime=pointing.exp_time,
        im_type=pointing.pointing_type,
        sat_pos=[pointing.sat_x, pointing.sat_y, pointing.sat_z],
        sat_vel=[pointing.sat_vx, pointing.sat_vy, pointing.sat_vz],
        project_cycle=self.overall_config["project_cycle"],
        run_counter=self.overall_config["run_counter"],
Zhang Xin's avatar
Zhang Xin committed
20
21
22
        chip_name=str(chip.chipID).rjust(2, '0'),
        obstype=pointing.survey_field_type,
        dataset=pointing.dataset)
Fang Yuedong's avatar
Fang Yuedong committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
    self.h_ext = generateExtensionHeader(
        chip=chip,
        xlen=chip.npix_x,
        ylen=chip.npix_y,
        ra=pointing.ra,
        dec=pointing.dec,
        pa=pointing.img_pa.deg,
        gain=chip.gain,
        readout=chip.read_noise,
        dark=chip.dark_noise,
        saturation=90000,
        pixel_scale=chip.pix_scale,
        pixel_size=chip.pix_size,
        xcen=chip.x_cen,
        ycen=chip.y_cen,
        extName=pointing.pointing_type,
        timestamp=pointing.timestamp,
        exptime=pointing.exp_time,
        readoutTime=chip.readout_time,
        t_shutter_open=pointing.t_shutter_open,
        t_shutter_close=pointing.t_shutter_close)

    return self.h_prim, self.h_ext


def updateHeaderInfo(self, header_flag='prim', keys=['key'], values=[0]):
    if header_flag == 'prim':
        for key, value in zip(keys, values):
            self.h_prim[key] = value
    if header_flag == 'ext':
        for key, value in zip(keys, values):
            self.h_ext[key] = value