simcado.simulation module

simulation.py

simcado.simulation.run(src, mode='wide', cmds=None, opt_train=None, fpa=None, detector_layout='small', filename=None, return_internals=False, filter_name=None, exptime=None, sub_pixel=False, sim_data_dir=None, **kwargs)[source]

Run a MICADO simulation with default parameters

Parameters
srcsimcado.Source

The object of interest

modestr, optional

[“wide”, “zoom”] Default is “wide”, for a 4mas FoV. “Zoom” -> 1.5mas

cmdssimcado.UserCommands, optional

A custom set of commands for the simulation. Default is None

opt_trainsimcado.OpticalTrain, optional

A custom optical train for the simulation. Default is None

fpasimcado.Detector, optional

A custom detector layout for the simulation. Default is None

detector_layoutstr, optional

[“small”, “centre”, “full”, “tiny”] Default is “small”. “small” - 1x 1k-detector centred in the FoV “tiny” - 128 x 128 pixels centred in the FoV “centre” - 1x 4k-detector centred in the FoV “full” - 9x 4k-detectors

filenamestr, optional

The filepath for where the FITS images should be saved. Default is None. If None, the output images are returned to the user as FITS format astropy.io.HDUList objects.

return_internalsbool

[False, True] Default is False. If True, the UserCommands, OpticalTrain and Detector objects used in the simulation are returned in a tuple: return hdu, (cmds, opt_train, fpa)

filter_namestr, TransmissionCurve

Analogous to passing INST_FILTER_TC as a keyword argument

exptimeint, float
[s] Total integration time. Currently, this is observed in one DIT

(i.e. NDIT=1). Use OBS_DIT and OBS_NDIT for more general setup.

sim_data_dirstr

Path to where the data is kept

simcado.simulation.snr(exptimes, mags, filter_name='Ks', cmds=None, **kwargs)[source]

Returns the signal-to-noise ratio(s) for given exposure times and magnitudes

Each time this runs, simcado runs a full simulation on a grid of stars. Therefore if you are interested in the SNR for many difference expoure times and a range of magnitudes, it is faster to pass all of them at once to this function. See the example section below.

Parameters
exptimesfloat, list

[s] A single or multiple exposure times

magsfloat, list

[mag] A single or multiple magnitudes

filter_namestr, optional

The name of the filter to be used - See get_filter_set() The default is “Ks”

cmdsUserCommands object, optional

Extra commands to be passed to simcado.simulation.run().

Returns
snr_returnlist

A list of SNR values for each exposure time and each magnitude

Examples

A basic example of wanting the SNR for a Ks=24 star in a 1 hr observation

>>> snr(exptimes=3600, mags=24)
[72.69760133863036]

However this is slow because it runs a full simulation. Hence it is better to do more at once If we want the SNR for the range of magnitudes J=[15, 20, 25, 30] for a 1 hr observation:

>>> snr(exptimes=3600, mags=[15,20,25,30], filter_name="J")
[array([  2.35125027e+04,   2.74921916e+03,   8.97552604e+01,
  8.18183097e-01])]

Now if we were interested in different exposure times, say 10 minutes and 5 hours, for a 24th magnitude star in the narrow band Br$gamma$ filter:

>>> # Chekc the name of the Brackett Gamma filter
>>> [name for name in simcado.optics.get_filter_set() if "Br" in name]
['BrGamma']
>>> snr(exptimes=[600, 18000], mags=24, filter_name="BrGamma")
[8.016218764390803, 42.71569256185457]
simcado.simulation.check_chip_positions(filename='src.fits', x_cen=17.084, y_cen=17.084, n=0.3, mode='wide')[source]

Creates a series of grids of stars and generates the output images

THe number of stars in each grid corresponds to the id number of the chip

simcado.simulation.limiting_mags(exptimes=None, filter_names=None, AB_corrs=None, limiting_sigma=5, return_mags=True, make_graph=False, mmin=22, mmax=31, cmds=None, **kwargs)[source]

Return or plot a graph of the limiting magnitudes for MICADO

Parameters
exptimesarray

[s] Exposure times for which limiting magnitudes should be found

filter_nameslist

A list of filters. See simcado.optics.get_filter_set()

AB_corrslist

[mag] A list of magnitude corrections to convert from Vega to AB magnitudes

limiting_sigmafloat

[sigma] The number of sigmas to use to define the limiting magnitude. Default is 5*sigma

return_magsbool

If True (defualt), the limiting magnitude are returned

make_graphbool

If True (defualt), a graph of the limiting magnitudes vs exposure time is plotted Calls plot_exptime_vs_limiting_mag()

cmdssimcado.UserCommands

A custom set of commands for building the optical train

Returns
mags_alllist

[mag] If return_mags=True, returns a list of limiting magnitudes for each exposure time for each filter Dimensions are [n, m] where n is the number of filters and m is the number of exposure times passed

Notes

Vega to AB = {“J” : 0.91 , “H” : 1.39 , “Ks” : 1.85}

Examples

:
>>> # Set 30 logarithmic time bins between 1 sec and 5 hours
>>> exptimes = np.logspace(0, np.log10(18000), num=30, endpoint=True)
>>> limiting_mags(exptimes=exptimes, filter_names=["J", "PaBeta"],
...               make_graph=False)
simcado.simulation.zeropoint(filter_name='TC_filter_Ks.dat')[source]

Returns the zero point magnitude for a SimCADO filter

This is an end-to-end simulation which aims to take into account all transmission effects incorporated in a SimCADO simulation.

The returned zeropoint is for an exposure of 1s. Therefore, magnitudes from measured fluxes in simulated images should be calculated as following

mag = -2.5*np.log10(counts/texp) + zp

where counts are the background subtracted counts, texp is the exposure time and zp is the zeropoint for the filter in question, calculated here.

Parameters
filter_name: A SimCADO filter
Returns
zp: the zeropoint magnitude