scopesim.utils

scopesim.utils#

Helper functions for ScopeSim.

Functions

airmass2zendist(airmass)

Convert airmass to zenith distance.

airmass_to_zenith_dist(airmass)

Return zenith distance in degrees.

array_minmax(arr)

Create min and max from array of points, useful for footprint.

bug_report()

Print versions of dependencies for inclusion in bug report.

bug_report_to_file(filename)

Like bug_report, but writes to file instead of printing.

change_table_entry(tbl, col_name, new_val[, ...])

check_keys(input_dict, required_keys[, ...])

Check to see if all/any of the required keys are present in a dict.

close_loop(iterable)

x, y = zip(*close_loop(zip(x, y)))

convert_table_comments_to_dict(tbl)

cube_plotter(cube_hdu)

Plot cube in separate plots for spatial and spectral parts.

deriv_polynomial2d(poly)

Derive (gradient) of a Polynomial2D model.

figure_factory([nrows, ncols])

Default way to init fig and ax, to easily modify later.

figure_grid_factory([nrows, ncols])

Gridspec variant.

find_file(filename[, path, silent])

Find a file in search path.

from_currsys(item[, cmds])

Return the current value of a bang-string from rc.__currsys__.

from_rc_config(item)

get_fits_type(filename)

get_meta_quantity(meta_dict, name[, ...])

Extract a Quantity from a dictionary.

has_needed_keywords(header[, suffix])

Check to see if the WCS keywords are in the header.

image_plotter(image_hdu)

Plot HDU image and add colorbar.

is_fits(filename)

link_irdb([irdb_path])

Set inst_pkgs to local clone of IRDB (convenience shortcut).

log_bug_report([level])

Emit bug report as logging message.

log_to_file([enable])

Enable or disable logging to file (convenience function).

nearest(arr, val)

Return the index of the value from arr which is closest to val.

parallactic_angle(ha, de[, lat])

Compute the parallactic angle.

pixel_area(header)

Calculate area covered by one pixel in arcsec**2 from header.

power_vector(val, degree)

Return the vector of powers of val up to a degree.

pretty_print_dict(dic[, indent])

quantify(item, unit[, cmds])

Ensure an item is a Quantity.

quantity_from_table(colname, table[, ...])

real_colname(name, colnames[, silent])

seq(start, stop[, step])

Replacement for numpy.arange modelled after R's seq function.

set_console_log_level([level])

Set the level for the console handler (convenience function).

set_inst_pkgs_path(pkg_path)

Set the local path for !SIM.file.local_packages_path (shortcut).

stringify_dict(dic[, ignore_types, fits_safe])

Turn a dict entries into strings for addition to FITS headers.

top_level_catch(func)

Catch any unhandled exceptions, log it including bug report.

unit_from_table(colname, table[, default_unit])

Look for the unit for a column based on the meta dict keyword "<col>_unit".

unit_includes_per_physical_type(unit, ...)

Check if one of the unit's bases is of 1/physical_type.

update_logging([capture_warnings])

Reload logging configuration from rc.__logging_config__.

write_report(text[, filename, output])

Write a report string to file in latex or rst format.

zendist2airmass(zendist)

Convert zenith distance to airmass.

zenith_dist_to_airmass(zenith_dist)

zenith_dist is in degrees.

zeros_from_header(header[, dtype, ndims])

Create all-zero array of the shape given by NAXISn keywords in header.

Exceptions

ScopesimPendingDeprecationWarning

A scopesim-specific subclass of PendingDeprecationWarning