Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 'observation': '002',
# 'visit': '001',
# 'visit_group': '02',
# 'parallel_seq_id': '1',
# 'activity': '02',
# 'exposure_id': '00001',
# 'detector': 'nis',
# 'suffix': 'uncal'}
# Example of locating a dataset in the filesystem
filesystem = get_config()['filesystem']
dataset = os.path.join(filesystem, 'jw{}'.format(filename_dict['program_id']),
filename_of_interest)
# Example of reading in dataset using jwst.datamodels
im = datamodels.open(dataset)
# Now have access to:
# im.data # Data array
# im.err # ERR array
# im.meta # Metadata such as header keywords
# Example of saving a file and setting permissions
im.save('some_filename.fits')
set_permissions('some_filename.fits')
# Example of creating and exporting a Bokeh plot
plt = Donut(im.data, plot_width=600, plot_height=600)
plt.sizing_mode = 'stretch_both' # Necessary for responsive sizing on web app
script, div = components(plt)
plot_output_dir = get_config()['outputs']
div_outfile = os.path.join(plot_output_dir, 'monitor_name',
``meta`` dictionary identifying the tweakwcs group. Images within
a group are aligned together.
"""
try:
from jwst.datamodels import open as open_data # pylint: disable=W0611
except ImportError:
raise ImportError("'assign_jwst_tweakwcs_groups' requires that "
"'jwst' package be installed.")
close = [isinstance(im, (str, bytes)) for im in images]
group_ids = {}
for im, cl in zip(images, close):
model = open_data(im) if cl else im
try:
meta_ids = (
model.meta.observation.program_number,
model.meta.observation.observation_number,
model.meta.observation.visit_number,
model.meta.observation.visit_group,
model.meta.observation.sequence_id,
model.meta.observation.activity_id,
model.meta.observation.exposure_number
)
if meta_ids in group_ids:
gid = group_ids[meta_ids]
else:
gid = str(uuid.uuid4())
# next loop will almost never execute as UUIDs should be