Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AoA studies #24

Draft
wants to merge 84 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
d6eaedc
correction on rhombus gap in detector wafer layout
smsimon May 28, 2021
e809804
correct decimal on MFLS2 band center and change LAT HF layouts to 5.2…
smsimon Jun 9, 2021
8d42efd
add field in bands for pixel to pixel correlation factor. Current def…
smsimon Jun 16, 2021
646aacc
Change band names to new convention
smsimon Jun 23, 2021
d36c446
tweak band edges to match noise sims
smsimon Jun 23, 2021
2f69d3e
Updated NET and correlation factor numbers for SPLAT
smsimon Jun 23, 2021
9ab25f2
Update NET, NET elevation scalings, and NET correlation factors for C…
smsimon Jul 1, 2021
f078151
NET elevation scalings for SPLAT
smsimon Jul 1, 2021
f01deb7
Updated noises and noise scalings for SAT, SPLAT, CHLAT
smsimon Jul 28, 2021
c2766b2
Toast3 focalplane (#22)
keskitalo Aug 6, 2021
23b60ed
Update column names to TOAST3 standard
keskitalo Aug 6, 2021
47b0063
Add DC1 scheduling for CHLAT
keskitalo Aug 20, 2021
1c7fe17
Add more schedules
keskitalo Sep 3, 2021
d2f3cda
Add last observing schedule
keskitalo Sep 3, 2021
098a745
Fix SPLAT efficiency by making the elevation range much larger
keskitalo Sep 3, 2021
a1765e1
Update pixel sizes and layout types for SAT MF. Add mechanism for new…
smsimon Sep 9, 2021
7588d93
Cut detectors based on FOV_cut
keskitalo Sep 10, 2021
af0d3f0
Tweak plate scale to get the detector counts to match
keskitalo Sep 13, 2021
fdac65c
Add tube keyword and make pixel ID unique
keskitalo Sep 24, 2021
c6a20ee
Update SAT MF1 and SAT MF2 noises
smsimon Oct 21, 2021
bd1b69b
Update SAT MF1/MF2 correlation factors
smsimon Oct 21, 2021
dbd6011
Trial run scripts and config files
keskitalo Nov 2, 2021
c732ae9
launch cmb simulation
keskitalo Nov 9, 2021
cca07f5
update scripts
keskitalo Nov 12, 2021
acfbb0b
tweaks
keskitalo Nov 19, 2021
013e148
update scripts
keskitalo Dec 1, 2021
0cdb294
add scripts
keskitalo Dec 3, 2021
2f42afb
Add files
keskitalo Dec 3, 2021
a78cebd
Different cache for the two CHLATs
keskitalo Dec 3, 2021
a804ee4
script tweaks
keskitalo Dec 13, 2021
d7c168a
Add NET vs. PWV fits to the hardware model (#23)
keskitalo Dec 14, 2021
46efd65
Add setup script
keskitalo Dec 16, 2021
93e737d
add paramter files
keskitalo Dec 16, 2021
b95af92
remove test command
keskitalo Dec 17, 2021
434ddff
add file
keskitalo Dec 17, 2021
59173f9
Add scripts
keskitalo Jan 6, 2022
b8288e7
upgrade parameter files
keskitalo Jan 13, 2022
4660fac
add parameter file
keskitalo Jan 25, 2022
79d0c7a
Check the fize size before purging
keskitalo Jan 27, 2022
91cf10b
tweak scripts
keskitalo Jan 27, 2022
c51fa30
add scripts
keskitalo Jan 27, 2022
1d8275e
Add new schedule files for optimal and non-optimal weather conditions
keskitalo Feb 2, 2022
5c71190
Rerun the SPLAT schedule to observe new boresight rotation limits
keskitalo Mar 22, 2022
c2ddd14
Add files
keskitalo Mar 22, 2022
47e4d87
Fix script that splits observing schedules by PWV
keskitalo Mar 29, 2022
7087282
update scripting
keskitalo Mar 29, 2022
4feeab3
new scripts
keskitalo Mar 30, 2022
9b9ea18
new scripts
keskitalo Apr 8, 2022
ef96a64
tweak plotting
keskitalo Apr 21, 2022
0c49601
Upgrade API
keskitalo Apr 21, 2022
89f6d8c
tweak script
keskitalo Apr 26, 2022
2f66fbb
mapstats now uses an input file rather than command line
keskitalo Apr 26, 2022
28d2f25
only one node per observation needed for LF
keskitalo Apr 26, 2022
14d5c49
Commit AoA scripts
keskitalo Jul 26, 2022
c439306
add missing script
keskitalo Jul 26, 2022
231e6a3
Latest modifications
keskitalo Jul 18, 2022
dc29562
tweak LAT patches
keskitalo Jul 26, 2022
36a28e4
Tweak scripts
keskitalo Jul 28, 2022
2f5bcc0
More tweaks
keskitalo Jul 29, 2022
140f966
add new files
keskitalo Aug 3, 2022
a5211c7
update to have structure for CHSAT and make HF SAT bands full wafers
Aug 1, 2022
fa6c769
update baseline SPSAT and CHSAT noise values and fits
smsimon Aug 3, 2022
a39e1a6
Adapt for CHSAT
keskitalo Aug 3, 2022
8566aec
update rescaling scripts
keskitalo Aug 5, 2022
94d0885
plot the field outlines over foreground map
keskitalo Aug 5, 2022
c75ce91
Latest scalings
keskitalo Aug 8, 2022
a3d1f19
latest scalings
keskitalo Aug 12, 2022
1d7f0a5
Most recent rescales
keskitalo Aug 23, 2022
d653c4c
Fix the length of the observing season
keskitalo Aug 23, 2022
fe60a91
fknee cannot be overridden from command line
keskitalo Aug 23, 2022
7881b04
Add a simple validation script
keskitalo Aug 23, 2022
e5129ee
fix typo
keskitalo Aug 24, 2022
d49ffe6
Add new plotting script
keskitalo Sep 8, 2022
bf3b454
update scripts to remove focalplane decimatino
keskitalo Sep 14, 2022
f293a07
Add scripts
keskitalo Sep 17, 2022
360c625
Dense SAT focalplanes
keskitalo Sep 30, 2022
944a817
tight_layout
keskitalo Sep 30, 2022
af5c9ba
better comparison
keskitalo Oct 4, 2022
14f05fe
add spsat wide strategy
keskitalo Oct 14, 2022
594f9fe
experimental madam params
keskitalo Oct 14, 2022
b2144cb
field outline
keskitalo Oct 14, 2022
7072ecd
new scripts
keskitalo Oct 20, 2022
983efba
new files
keskitalo Nov 8, 2022
caaa722
small tweak to analyze_schedule
keskitalo Nov 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions AoA/focalplanes/compare_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from glob import glob
import os
import sys

from astropy.io.misc.hdf5 import read_table_hdf5
import matplotlib.pyplot as plt
import numpy as np


pwv = np.linspace(0, 3, 100)
el = np.linspace(40, 60, 100)

nrow, ncol = 2, 2
fig = plt.figure(figsize=[8 * ncol, 4 * nrow])
ax1 = fig.add_subplot(nrow, ncol, 1)
ax2 = fig.add_subplot(nrow, ncol, 2)
ax3 = fig.add_subplot(nrow, ncol, 3)
ax4 = fig.add_subplot(nrow, ncol, 4)
ax1.set_title("NET factor vs. elevation")
ax2.set_title("NET factor vs. PWV")
ax3.set_title("NET ratio vs. elevation")
ax4.set_title("NET ratio vs. PWV")
ax1.set_xlabel("Elevation [deg]")
ax2.set_xlabel("PWV [mm]")
ax3.set_xlabel("Elevation [deg]")
ax4.set_xlabel("PWV [mm]")

fmt = "--"
for band in "f030", "f040", "f085", "f095", "f145", "f155", "f220", "f280":
if band == "f085":
fmt = "-"
elif band == "f220":
fmt = ":"
table_pole = read_table_hdf5(glob(f"focalplane_SAT*_SAT_{band}.h5")[0])
table_chile = read_table_hdf5(glob(f"focalplane_CHSAT*_CHSAT_{band}.h5")[0])

net_pole = table_pole["psd_net"][0]
pwv_a0_pole = table_pole["pwv_noise_a0"][0]
pwv_a1_pole = table_pole["pwv_noise_a1"][0]
pwv_a2_pole = table_pole["pwv_noise_a2"][0]
elevation_a_pole = table_pole["elevation_noise_a"][0]
elevation_c_pole = table_pole["elevation_noise_c"][0]

net_chile = table_chile["psd_net"][0]
pwv_a0_chile = table_chile["pwv_noise_a0"][0]
pwv_a1_chile = table_chile["pwv_noise_a1"][0]
pwv_a2_chile = table_chile["pwv_noise_a2"][0]
elevation_a_chile = table_chile["elevation_noise_a"][0]
elevation_c_chile = table_chile["elevation_noise_c"][0]

pwv_factor_pole = pwv_a0_pole + pwv_a1_pole * pwv + pwv_a2_pole * pwv**2
elevation_factor_pole = elevation_a_pole / np.sin(np.radians(el)) + elevation_c_pole

pwv_factor_chile = pwv_a0_chile + pwv_a1_chile * pwv + pwv_a2_chile * pwv**2
elevation_factor_chile = elevation_a_chile / np.sin(np.radians(el)) + elevation_c_chile

ax1.plot(el, elevation_factor_chile, fmt, label=f"Chile {band}")
ax1.plot(el, elevation_factor_pole, fmt, label=f"Pole {band}")
ax2.plot(pwv, pwv_factor_chile, fmt, label=f"Chile {band}")
ax2.plot(pwv, pwv_factor_pole, fmt, label=f"Pole {band}")
ax3.plot(pwv, net_chile * elevation_factor_chile / net_pole / elevation_factor_pole, fmt, label=band)
ax4.plot(pwv, net_chile * pwv_factor_chile / net_pole / pwv_factor_pole, fmt, label=band)

ax2.legend(loc="best")
ax4.legend(loc="best")
plt.tight_layout()
plt.savefig("net_comparison.png")
20 changes: 20 additions & 0 deletions AoA/focalplanes/make_focalplanes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

fknee="--fknee 1e-6 --fmin 1e-10"

s4_hardware_to_toast3.py $fknee --telescope CHSAT0
s4_hardware_to_toast3.py $fknee --telescope CHSAT1
s4_hardware_to_toast3.py $fknee --telescope CHSAT2
s4_hardware_to_toast3.py $fknee --telescope CHSAT3
s4_hardware_to_toast3.py $fknee --telescope CHSAT4
s4_hardware_to_toast3.py $fknee --telescope CHSAT5

s4_hardware_to_toast3.py $fknee --telescope SAT0
s4_hardware_to_toast3.py $fknee --telescope SAT1
s4_hardware_to_toast3.py $fknee --telescope SAT2
s4_hardware_to_toast3.py $fknee --telescope SAT3
s4_hardware_to_toast3.py $fknee --telescope SAT4
s4_hardware_to_toast3.py $fknee --telescope SAT5

s4_hardware_to_toast3.py $fknee --telescope LAT0
s4_hardware_to_toast3.py $fknee --telescope LAT2
139 changes: 139 additions & 0 deletions AoA/scan_strategies/analyze_schedule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
from glob import glob
import os
import sys

import matplotlib.pyplot as plt
import numpy as np


do_plot = False

if do_plot:
fig = plt.figure(figsize=[18, 12])
nrow, ncol = 2, 2
ax1 = fig.add_subplot(nrow, ncol, 1)
ax2 = fig.add_subplot(nrow, ncol, 2)
ax3 = fig.add_subplot(nrow, ncol, 3)

colors = ["tab:blue", "tab:orange", "tab:green", "tab:pink"]

if len(sys.argv) == 1:
print("Usage: {sys.argv[0]} <input directory> [schedule time days]")
sys.exit()

indir = sys.argv[1]
if len(sys.argv) == 3:
schedule_days = float(sys.argv[2])
else:
schedule_days = None
fnames = sorted(glob(indir + "/*txt"))

for i, fname in enumerate(fnames):
if do_plot:
color = colors[i]
print("\n{}".format(fname))

with open(fname, "r") as fin:
fin.readline()
header = fin.readline()
try:
site, telescope, lat, lon, alt = header.split()
except:
print(f"ERROR: failed to parse {fname}", flush=True)
continue
if np.abs(float(lat)) > 85:
pole_site = True
else:
pole_site = False

# schedule = np.genfromtxt(fname, skip_header=3).T

arr = np.genfromtxt(
fname,
skip_header=3,
usecols=[4, 5, 7, 8, 9, 10],
dtype="f8,f8,S30,f8,f8,f8",
names=["starts", "stops", "names", "az_mins", "az_maxs", "elevations"],
)
lengths = arr["stops"] - arr["starts"]
throws = arr["az_maxs"] - arr["az_mins"]

if lengths.size == 0:
print(f"No scans found in {fname}")
continue

if lengths.size == 1:
print(f"Only one scan in {fname}")
continue

last_el = None
line = 3
for start, stop, az_min, az_max, el, name in zip(
arr["starts"], arr["stops"], arr["az_mins"], arr["az_maxs"], arr["elevations"], arr["names"],
):
line += 1
if not pole_site and az_min < 180 and az_max > 180:
print(
f"WARNING: Found a mixed Rising/Setting scan: {az_min} - {az_max}. line = {line}",
flush=True,
)
if last_el is None:
label = os.path.basename(fname).replace(".txt", "")
else:
label = None
if do_plot:
ax1.plot([start, stop], [el, el], color=color, label=label)
if last_el is not None:
ax2.plot([last_stop, start], [last_el, el], color=color, label=label)
ax3.plot([az_min, az_max], [el, el], color=color, label=label)
last_stop = stop
last_el = el

is_horizontal = np.array([
name.decode().startswith("RISING_SCAN") or name.decode().startswith("SETTING_SCAN") for name in arr["names"]
])

average_el = np.sum(arr["elevations"] * lengths) / np.sum(lengths)

integration_time = np.sum(arr["stops"] - arr["starts"])
integration_time_horizontal = np.sum(arr["stops"][is_horizontal] - arr["starts"][is_horizontal])
schedule_time = arr["stops"][-1] - arr["starts"][0]
t_steps = arr["starts"][1:] - arr["stops"][:-1]
el_steps = np.diff(arr["elevations"])
total_el = np.sum(np.abs(el_steps))
if "short_stabilization" in indir:
# Isolate the steps that last less than 12 minutes
print("Assuming stabilization time is 5 minutes")
in_observation = t_steps <= (12 * 60) / 86400
else:
# stabilization time is 30 minutes, calibration break is 5 minutes
print("Assuming stabilization time is 30 minutes")
in_observation = t_steps <= (37 * 60) / 86400
obs_el = np.sum(np.abs(el_steps[in_observation]))
steps = np.abs(el_steps[in_observation])
large = steps > 1
obs_el_large = np.sum(steps[large])
average_throw = np.mean(np.abs(throws))

average_rate = 1.0 / np.cos(np.radians(average_el))

if schedule_days is not None:
print(f"Overriding schedule_time = {schedule_time} with {schedule_days}")
schedule_time = schedule_days

print("Schedule time: {:.3f} days".format(schedule_time))
print("Integration time: {:.3f} days".format(integration_time))
print("Observing efficiency: {:.1f} %".format(integration_time / schedule_time * 100))
print("Integration time (Horizontal): {:.3f} days".format(integration_time_horizontal))
print("Observing efficiency (Horizontal): {:.3f} %".format(integration_time_horizontal / schedule_time * 100))
print("Average elevation: {:.3f} deg".format(average_el))
print("Average throw: {:.3f} deg".format(average_throw))
print("Average Az-rate: {:.3f} deg (for 1 deg/s on sky)".format(average_rate))
print("Elevation travelled: {:.3f} deg".format(total_el))
print("Elevation travelled: {:.3f} deg (during observation)".format(obs_el))
print("Elevation travelled: {:.3f} deg (requiring stabilization)".format(obs_el_large), flush=True)

if do_plot:
ax3.legend(loc="best")
fig.savefig("schedules.png")
plt.close()
14 changes: 14 additions & 0 deletions AoA/scan_strategies/chlat_for_chsat_s4/get_schedule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#/bin/bash

#python3 make_lat_tiles.py

export TOAST_LOGLEVEL=DEBUG

# Run all the schedules

# --block-out 01/15-03/15

toast_ground_schedule \
@schedule_lat.par \
@patches_lat.txt \
>& get_schedule.log &
Loading