-
Notifications
You must be signed in to change notification settings - Fork 10
Reading MEDS Files in Python
Erin Sheldon edited this page Mar 23, 2017
·
3 revisions
import meds
# create a MEDS object for the given MEDS file
m=meds.MEDS(filename)
# read a cutout for object 35, cutout index 5
index=35
cutout_index=5
image=m.get_cutout(index, cutout_index)
# typically the coadd is stored at cutout_index=0
cutout_index=0
coadd_im = m.get_cutout(index, cutout_index)
# get other image types
seg = m.get_cutout(index, cutout_index, type=’seg’)
wt = m.get_cutout(index, cutout_index, type=’weight’)
mask = m.get_cutout(index, cutout_index, type=’bmask’)
# get a python list of all cutouts for this object
imlist = m.get_cutout_list(index)
seglist = m.get_cutout_list(index,type=’seg’)
# The contents of the object data table is loaded when the MEDS object is
# created, and are accessible by name.
# number of cutouts
ncutout=m[’ncutout’][index]
# process all objects
for i in xrange(m.size):
imlist=m.get_cutout_list(i)
# process the images
# get the jacobian of the WCS transformation
# as a dict
j=m.get_jacobian(index, cutout_index)
# as a numpy matrix
j=m.get_jacobian_matrix(index, cutout_index)
# list for all cutouts
jlist=m.get_jacobian_list(index)
# get the "ubserseg" weight map
wt=m.get_cweight_cutout_nearest(index, cutout_index)