You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In previous versions of SNANA (before March/2022), the simlibs coadds were not working properly; not all the observations in the same night of the same passband were coadded. I made a function to check if a sndata dataset suffers from this issue. It would be great to add it to the base class in sndata.
Code:
def find_bad_coadd(dataset):
obj_names = dataset.object_names[:3]
pbs = dataset.filter_set
number_obs_per_night = []
for i in np.arange(len(obj_names)):
obj = obj_names[i]
obj_data = dataset.data[obj]
for pb in pbs:
is_pb = obj_data['filter'] == pb
obj_data_pb = obj_data[is_pb]
obj_mjd_pb = np.array(obj_data_pb['mjd'])
time_diff = obj_mjd_pb[1:] - obj_mjd_pb[:-1]
index_change_night = np.where(time_diff >.5)[0] + 1
number_obs_per_night_obj = np.zeros(len(index_change_night) + 1)
number_obs_per_night_obj[0] = index_change_night[0]
number_obs_per_night_obj[1:-1] = index_change_night[1:] - index_change_night[:-1]
number_obs_per_night_obj[-1] = len(obj_mjd_pb) - index_change_night[-1]
# we expect one visit per night in each passband, so subtract it
number_obs_per_night_obj -= 1
if np.sum(number_obs_per_night_obj) > 0:
print(obj, pb)
print(number_obs_per_night_obj)
sys.exit('It should have only one visit per night in each filter.')
print('No repeats')
The text was updated successfully, but these errors were encountered:
In previous versions of SNANA (before March/2022), the simlibs coadds were not working properly; not all the observations in the same night of the same passband were coadded. I made a function to check if a
sndata
dataset suffers from this issue. It would be great to add it to the base class insndata
.Code:
The text was updated successfully, but these errors were encountered: