Skip to content
Merged
Changes from all commits
Commits
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
28 changes: 9 additions & 19 deletions sotodlib/site_pipeline/make_atomic_filterbin_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,6 @@ def from_yaml(cls, path) -> "Cfg":
class DataMissing(Exception):
pass

def get_pwv(start_time, stop_time, data_dir):
try:
pwv_info = hk_utils.get_hkaman(
float(start_time), float(stop_time), alias=['pwv'],
fields=['site.env-radiometer-class.feeds.pwvs.pwv'],
data_dir=data_dir)
pwv_all = pwv_info['env-radiometer-class']['env-radiometer-class'][0]
pwv = np.nanmedian(pwv_all)
except (KeyError, ValueError):
pwv = 0.0
return pwv

def get_sun_distance(site, ctime, az, el):
site_ = so3g_coords.SITES[site].ephem_observer()
dtime = dt.datetime.fromtimestamp(ctime, dt.timezone.utc)
Expand Down Expand Up @@ -433,12 +421,7 @@ def main(

tag = "%5d/%d" % (oi+1, len(obskeys))
putils.mkdir(os.path.dirname(prefix))
#pwv_atomic = get_pwv(periods[pid, 0], periods[pid, 1], args.hk_data_path)

# Save file for data base of atomic maps.
# We will write an individual file,
# another script will loop over those files
# and write into sqlite data base
if not args.only_hits:
info_list = []
for split_label in split_labels:
Expand All @@ -455,9 +438,16 @@ def main(
info['prefix_path'] = str(prefix + '_%s' % split_label)
info['elevation'] = obs_infos[obslist[0][3]].el_center
info['azimuth'] = obs_infos[obslist[0][3]].az_center
#info['pwv'] = float(pwv_atomic)
info['roll_angle'] = obs_infos[obslist[0][3]].roll_center
info['sun_distance'] = get_sun_distance(args.site, int(t), obs_infos[obslist[0][3]].az_center, obs_infos[obslist[0][3]].el_center)
try:
info['pwv'] = obs_infos[obslist[0][3]].pwv_mean
info['dpwv'] = obs_infos[obslist[0][3]].pwv_std
info['roll_angle'] = obs_infos[obslist[0][3]].roll_center
info['scan_speed'] = obs_infos[obslist[0][3]].scan_vel
info['scan_acc'] = obs_infos[obslist[0][3]].scan_accel
except (AttributeError, KeyError):
# if these are not in the obsdb then we get here and we skip
continue
info_list.append(info)
# inputs that are unique per atomic map go into run_list
if args.area is not None:
Expand Down