SimCADO Package¶
simcado.commands module¶
simcado.commands Module¶
Functions¶
|
Dump the frequent.config file to a path specified by the user |
|
Dump the FPA_chip_layout.dat file to a path specified by the user |
|
Dump the EC_mirrors_scope.tbl or the EC_mirrors_ao.tbl to disk |
|
Read in a SimCADO configuration file |
|
Update a SimCADO configuration dictionary |
Classes¶
|
An extended dictionary with the parameters needed for running a simulation |
simcado.detector module¶
simcado.detector Module¶
A description of the Chip noise properties and their positions on the Detector
Module Summary¶
This module holds three classes: Detector, Chip and HXRGNoise.
Chip
Everything to do with photons and electrons happens in the Chip class. Each
Chip is initialised with a position relative to the centre of the detector
array, a size [in pixels] and a resolution [in arcsec]. Photons fall onto the
Chip s and are read out together with the read noise characteristics of the
Chip.
Detector
The Detector holds the information on where the Chip s are placed on the
focal plane. Focal plane coordinates are in [arcsec]. These coordinates are
either read in from a default file or determined by the user. The Detector
object is an intermediary - it only passes information on the photons to the
Chip s. It is mainly a convenience class so that the user can read out all
Chip s at the same time.
Classes¶
- Detector
builds an array of
Chipobjects based on aUserCommandsobject- Chip
converts incoming photons into ADUs and adds in read-out noise
See Also¶
Notes¶
References¶
[1] Bernhard Rauscher’s HxRG Noise Generator script
Examples¶
The Detector can be used in stand-alone mode. In this case it outputs
only the noise that a sealed-off detector would generate:
>>> import simcado
>>> fpa = simcado.Detector(simcado.UserCommands())
>>> fpa.read_out(output=True, chips=[0])
The Detector is more useful if we combine it with a Source
object and an OpticalTrain. Here we create a Source object
for an open cluster in the LMC and pass the photons arriving from it through the
E-ELT and MICADO. The photons are then cast onto the detector array. Each
Chip converts the photons to ADUs and adds the resulting image to an
Astropy HDUList. The HDUList is then written to disk.
>>> # Create a set of commands, optical train and detector
>>>
>>> import simcado
>>> cmds = simcado.UserCommands()
>>> opt_train = simcado.OpticalTrain(cmds)
>>> fpa = simcado.Detector(cmds)
>>>
>>> # Pass photons from a 10^4 Msun open cluster in the LMC through to the detector
>>>
>>> src = sim.source.source_1E4_Msun_cluster()
>>> src.apply_optical_train(opt_train, fpa)
>>>
>>># Read out the detector array to a FITS file
>>>
>>> fpa.read_out(filename="my_raw_image.fits")
Functions¶
|
Opens a saved |
|
Plot the contents of a detector array |
|
Plot the detector layout |
|
Create a large noise cube with many separate readout frames. |
|
Install a noise cube in the package directory |
Classes¶
|
Generate a series of |
|
Holds the “image” as seen by a single chip in the focal plane |
simcado.nghxrg module¶
simcado.nghxrg Module¶
NGHXRG by Bernard Rauscher see the paper: http://arxiv.org/abs/1509.06264 downloaded from: http://jwst.nasa.gov/publications.html
Classes¶
|
A class to generate HxRG noise frames |
simcado.optics module¶
simcado.optics Module¶
optics.py
Functions¶
|
Return a Vis/NIR broadband filter TransmissionCurve object |
|
Return a list of the filters installed in the package directory |
Classes¶
|
The OpticalTrain object reads in or generates the information necessary to model the optical path for all (3) sources of photons: the astronomical source, the atmosphere and the primary mirror. |
simcado.psf module¶
simcado.psf Module¶
PSFs and PSFCubes¶
Todo
revise this opening text
Description¶
Car Sagan said
- “If you want to bake an apple pie from scratch,
first you must create the universe”
Single PSFs¶
We need to start by generating a single PSF in order to generate a PSFCube. We need to know the spatial characteristics of the PSF: The commonalities of all PSFs are:
pix_width
pix_height
pix_res
type
The types of PSF offered: Moffat, Gaussian2D, Airy, Delta, Line, User For each of the PSF types we need to create a subclass of PSF. Each subclass takes its own list of parameters:
MoffatPSF (alpha, beta)
GaussianPSF (fwhm, eccentricity=0, angle=0)
AiryPSF (first_zero, eccentricity=0, angle=0)
DeltaPSF (x=0, y=0)
LinePSF (x0, x1, y0, y1, angle=0)
UserPSFCube (filename, ext_no=0)
Multiple PSFs in a Cube¶
To generate a PSF cube we need to know the spectral bins and the type of PSF. The bins are defined by a central wavelength, however a cube should also contain the edges of each bin so that transmission and emission can be re-binned properly. - lam_bin_centers - lam_bin_edges - lam_res
A PSF instance will have these additional arguments: - array … a 2D array to hold the PSF image
A psf instance will have these additional arguments: - cube … a (l,x,y) 3D array to hold the PSF cube
As far as input goes, psf should be able to accept a dictionary with the keywords necessary to build the cube.
Notes¶
All wavelength values are given in [um] All pixel dimensions are given in [arcsec] All angles are given in [deg]
Classes¶
PSF(object) psf(object)
Subclasses¶
MoffatPSF(PSF) GaussianPSF(PSF) AiryPSF(PSF) DeltaPSF(PSF) LinePSF(PSF) UserPSFCube(PSF)
Deltapsf(psf) Airypsf(psf) Gaussianpsf(psf) Moffatpsf(psf) CombinedPSFCube(psf) UserPSFCube(psf) ADC_psf(psf)
There are two types of psf object here: - a cube - a single psf image
The cube is essentially a list of psf images, homogenized in size Should we have separate classes for these?
Both PSF and psf can be created from a single model or through convolution of a list of PSF components
Functions¶
|
Generate a PSF for the E-ELT for plan A or B with POPPY |
|
Create a diffraction limited E-ELT PSF with a Seeing halo |
|
Return a seeing limited PSF |
|
Generate a list of segments for POPPY for the E-ELT |
|
Combine several PSF FITS images into a single PSF FITS file |
Classes¶
|
Point spread function (single layer) base class |
|
Class holding wavelength dependent point spread function. |
|
Generate a PSF for a Moffat function. |
|
Generate a list of MoffatPSFs for wavelengths defined in lam_bin_centers |
|
Generate a PSF for an Airy function with an equivalent FWHM |
|
Generate a list of AiryPSFs for wavelengths defined in lam_bin_centers |
|
Generate a PSF for an Gaussian function |
|
Generate a list of GaussianPSFs for wavelengths defined in lam_bin_centers |
|
Generate a PSF with a delta function at position (x,y) |
|
Generate a list of DeltaPSFs for wavelengths defined in lam_bin_centers |
|
Generate a PSF from a collection of several PSFs. |
|
Generate a list of CombinedPSFCubes from the list of psfs in psf_list |
|
Import a PSF from a FITS file. |
|
Read in a psf previously saved as a FITS file |
|
simcado.simulation module¶
simcado.simulation Module¶
simulation.py
Functions¶
|
Run a MICADO simulation with default parameters |
|
Returns the signal-to-noise ratio(s) for given exposure times and magnitudes |
|
Creates a series of grids of stars and generates the output images |
|
Return or plot a graph of the limiting magnitudes for MICADO |
|
Returns the zero point magnitude for a SimCADO filter |
simcado.source module¶
simcado.source Module¶
The module that contains the functionality to create Source objects
Module Summary¶
The Source is essentially a list of spectra and a list of positions. The list of positions contains a reference to the relevant spectra. The advantage here is that if there are repeated spectra in a data cube, we can reduce the amount of calculations needed. Furthermore, if the input is originally a list of stars, etc., where the position of a star is not always an integer multiple of the plate scale, we can keep the information until the PSFs are needed.
Classes¶
Source
Functions¶
Functions to create Source objects
empty_sky()
star(mag, filter_name="Ks", spec_type="A0V", x=0, y=0)
stars(mags, filter_name="Ks", spec_types=["A0V"], x=[0], y=[0])
star_grid(n, mag_min, mag_max, filter_name="Ks", separation=1, area=1,
spec_type="A0V")
source_from_image(images, lam, spectra, pix_res, oversample=1,
units="ph/s/m2", flux_threshold=0,
center_pixel_offset=(0, 0))
source_1E4_Msun_cluster(distance=50000, half_light_radius=1)
Functions for manipulating spectra for a Source object
scale_spectrum(lam, spec, mag, filter_name="Ks", return_ec=False)
scale_spectrum_sb(lam, spec, mag_per_arcsec, pix_res=0.004,
filter_name="Ks", return_ec=False)
flat_spectrum(mag, filter_name="Ks", return_ec=False)
flat_spectrum_sb(mag_per_arcsec, filter_name="Ks", pix_res=0.004,
return_ec=False)
Functions regarding photon flux and magnitudes
zero_magnitude_photon_flux(filter_name)
_get_stellar_properties(spec_type, cat=None, verbose=False)
_get_stellar_mass(spec_type)
_get_stellar_Mv(spec_type)
_get_pickles_curve(spec_type, cat=None, verbose=False)
Helper functions
value_at_lambda(lam_i, lam, val, return_index=False)
SED(spec_type, filter_name="V", magnitude=0.)
Functions¶
|
Creates a simcado.Source object for a star with a given magnitude |
|
Creates a simcado.Source object for a bunch of stars. |
|
Generate a source object for a cluster |
|
Creates a simcado.Source object for a point source with a given magnitude |
|
Create a extended |
|
Creates a spiral profile with arbitary parameters |
|
Create a extended |
|
Returns a 2D array with a normalised Sersic profile |
|
Create a Source object from an image or a list of images. |
|
Creates a square grid of A0V stars at equal magnitude intervals |
Returns an empty source so that instrumental fluxes can be simulated |
|
|
Return a scaled SED for a star or type of galaxy |
|
Redshift a SimCADO SED and scale it to a magnitude in a user specified filter |
|
Compute the deflection of an SIE (singular isothermal ellipsoid) potential |
|
Apply a singular isothermal ellipsoid (SIE) gravitational lens to an image |
|
Return a list of the SEDs installed in the package directory |
|
Scale a spectrum to be a certain magnitude |
|
Scale a spectrum to be a certain magnitude per arcsec2 |
|
Return a flat spectrum scaled to a certain magnitude |
|
Return a flat spectrum for a certain magnitude per arcsec |
|
Return the value at a certain wavelength - i.e. |
|
Returns the latest main sequence spectral type(s) for (a) B-V colour |
|
Return the number of photons for a m=0 star for a filter with synphot |
|
Return the number of photons for a certain filter and magnitude |
|
Return the number of photons for a certain filter and magnitude |
|
Returns the emission curve for a single or list of |
|
Returns an |
|
Returns a single (or list of) float(s) with the V-band absolute magnitude(s) |
|
Returns a single (or list of) float(s) with the stellar mass(es) |
Classes¶
|
Create a source object from a file or from arrays |
simcado.spatial module¶
simcado.spatial Module¶
TODO: Insert docstring
Functions¶
|
A method to simulate tracking errors ===== Currently a place holder with minimum functionality ========= !! TODO, work out the shift during the DIT for the object RA, DEC etc !! |
|
A method to simulate field rotation in case the derotator is <100% effective ===== Currently a place holder with minimum functionality ========= !! TODO, work out the rotation during the DIT for the object RA, DEC etc !! |
|
A method to simulate wind jitter ===== Currently a place holder with minimum functionality ========= !! TODO, get the read spectrum for wind jitter !! !! Add in an angle parameter for the ellipse !! |
|
Generates a list of x and y shifts from a commands object |
|
Generate distortion maps based on star positions. |
|
Returns the distortion offsets for position relative to the FoV centre |
simcado.spectral module¶
simcado.spectral Module¶
Classes for spectral curves
Functions¶
|
Return a spectral curve for the sky for a certain airmass |
Classes¶
|
Very basic class to either read in a text file for a transmission curve or take two vectors to make a transmission curve |
|
Class for emission curves |
|
Blackbody emission curve |
|
Constant transmission curve |
simcado.utils module¶
simcado.utils Module¶
Helper functions for SimCADO
Functions¶
|
Adds the SED given in |
|
Add a keyword, value pair to an extension header in a FITS file |
|
Returns a combined magnitude for a group of objects with |
|
Convert airmass to zenith distance |
|
returns zenith distance in degrees |
|
Returns the angular distance of an object in arcseconds. |
|
Compute atmospheric refraction |
Get versions of dependencies for inclusion in bug report |
|
|
Derivatives (gradient) of a Polynomial2D model |
mu = 5 * np.log10(d) - 5 |
|
d = 10**(1 + mu / 5) |
|
|
Download the extra data that aren’t in the SimCADO package |
|
Find a file in search path |
Downloads large files that SimCADO needs to simulate MICADO |
|
|
Checks if file is a FITS file based on extension |
|
!!Unfinished!! Return a Moffat function |
|
Prints a message based on the level of verbosity given in cmds |
|
Return the index of the value from ‘arr’ which is closest to ‘val’ |
|
Compute the parallactic angle |
|
Add a realisation of the poisson process to the array ‘arr’. |
|
Ensure an item is a Quantity |
|
Replacement for numpy.arange modelled after R’s seq function |
|
Returns the diffraction limit of a telescope |
|
Turn an angular distance into a proper transverse distance |
|
Convert all types of input to an astropy array/unit pair |
|
Convert zenith distance to airmass |
|
|