Pointing.py 1.45 KB
Newer Older
Fang Yuedong's avatar
Fang Yuedong committed
1
2
3
import os
import numpy as np
from Config import ReadConfig
Fang Yuedong's avatar
Fang Yuedong committed
4
from datetime import datetime
Fang Yuedong's avatar
Fang Yuedong committed
5

Fang Yuedong's avatar
Fang Yuedong committed
6
work_dir = "/public/home/fangyuedong/test/CSST/test/"
Fang Yuedong's avatar
Fang Yuedong committed
7
8
9
10
11
data_dir = "/data/simudata/CSSOSDataProductsSims/data/"

config_file = os.path.join(work_dir, "ObservationSim.cfg")
config = ReadConfig(config_file)

12
13
exp_time = float(config['exp_time'])

Fang Yuedong's avatar
Fang Yuedong committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Read Pointing list
pointing_file = os.path.join(data_dir, "pointing10_20210202.dat")
f = open(pointing_file, 'r')
for _ in range(1):
    header = f.readline()
iline = 0
pRA = []
pDEC = []
for line in f:
    line = line.strip()
    columns = line.split()
    pRA.append(float(columns[0]))
    pDEC.append(float(columns[1]))
f.close()
pRA = np.array(pRA)
pDEC = np.array(pDEC)

Fang Yuedong's avatar
Fang Yuedong committed
31
32
33
34
35
36
37
38
39
40
41
# Create calibration pointings
ncal = 1 # Define the number of calibration pointings
pointing_type = ['MS']*len(pRA)
pRA = np.append(pRA[:ncal], pRA)
pDEC = np.append(pDEC[:ncal], pDEC)
pointing_type = ['CAL']*ncal + pointing_type

# Calculate starting time(s)
t0 = datetime(2021, 5, 25, 12, 0, 0)
t = datetime.timestamp(t0)
timestamp_obs = []
42
delta_t = 10 # Time elapsed between exposures (minutes)
Fang Yuedong's avatar
Fang Yuedong committed
43
44
45
for i in range(len(pointing_type)):
    timestamp_obs.append(t)
    if pointing_type[i] == 'CAL':
46
        t += 3 * delta_t * 60 # 3 calibration exposure
Fang Yuedong's avatar
Fang Yuedong committed
47
    elif pointing_type[i] == 'MS':
48
49
50
51
        t += delta_t * 60

timestamp_obs = np.array(timestamp_obs)
pointing_type = np.array(pointing_type)
Fang Yuedong's avatar
Fang Yuedong committed
52

Fang Yuedong's avatar
Fang Yuedong committed
53
# Define the range of pointing list
Fang Yuedong's avatar
Fang Yuedong committed
54
55
# pRange = range(0, 2)
pRange = [1, 22]