Tools

Cube

class marvin.tools.cube.Cube(input=None, filename=None, mangaid=None, plateifu=None, mode=None, data=None, release=None, drpall=None, download=None, nsa_source='auto')[source]

Bases: marvin.tools.core.MarvinToolsClass, marvin.tools.mixins.nsa.NSAMixIn, marvin.tools.mixins.aperture.GetApertureMixIn

A class to interface with MaNGA DRP data cubes.

This class represents a fully reduced DRP data cube, initialised either from a file, a database, or remotely via the Marvin API.

See MarvinToolsClass and NSAMixIn for a list of input parameters.

download()[source]

Downloads the cube using sdss_access - Rsync,

getMaps(**kwargs)[source]

Retrieves the DAP Maps for this cube.

If called without additional kwargs, getMaps() will initialise the Maps using the plateifu of this Cube. Otherwise, the kwargs will be passed when initialising the Maps.

getRSS()[source]

Returns the RSS associated with this Cube.

getSpaxel(x=None, y=None, ra=None, dec=None, maps=False, modelcube=False, **kwargs)[source]

Returns the Spaxel matching certain coordinates.

The coordinates of the spaxel to return can be input as x, y pixels relative to``xyorig`` in the cube, or as ra, dec celestial coordinates.

Parameters:
  • x,y (int or array) – The spaxel coordinates relative to xyorig. If x is an array of coordinates, the size of x must much that of y.
  • ra,dec (float or array) – The coordinates of the spaxel to return. The closest spaxel to those coordinates will be returned. If ra is an array of coordinates, the size of ra must much that of dec.
  • xyorig ({'center', 'lower'}) – The reference point from which x and y are measured. Valid values are 'center', for the centre of the spatial dimensions of the cube, or 'lower' for the lower-left corner. This keyword is ignored if ra and dec are defined. xyorig defaults to marvin.config.xyorig.
  • maps (Maps or None or bool) – If True, the spaxel will be initiated with the DAP properties from the default Maps matching this cube.
  • modelcube (ModelCube or None or bool) – A ModelCube object representing the DAP modelcube entity. If None, the Spaxel will be returned without model information. Default is False.
Returns:

spaxels (list) – The Spaxel objects for this cube corresponding to the input coordinates. The length of the list is equal to the number of input coordinates.

get_available_bintypes()[source]

List the available DAP binning schemes for this object

For data_origin of file or API, uses the local DAPall summary file to determine the available bintypes for a given plateifu.

dispersion

Returns a DataCube object with the dispersion.

dispersion_prepixel

Returns a DataCube object with the prepixel dispersion.

flux

Returns a DataCube object with the flux.

spectral_resolution

Returns a Spectrum with the spectral dispersion.

spectral_resolution_prepixel

Returns a Spectrum with the prepixel spectral dispersion.

Plate

class marvin.tools.plate.Plate(input=None, filename=None, mangaid=None, plateifu=None, mode=None, data=None, release=None, plate=None, download=None, nocubes=None)[source]

Bases: marvin.tools.core.MarvinToolsClass, marvin.utils.general.structs.FuzzyList

A class to interface with MaNGA Plate.

This class represents a Plate, initialised either from a file, a database, or remotely via the Marvin API. The class inherits from Python’s list class, and is defined as a list of Cube objects. As it inherits from list, it can do all the standard Python list operations.

When instanstantiated, Marvin Plate will attempt to discover and load all the Cubes associated with this plate.

Parameters:
  • plate (str) – The plate id of the Plate to load.
  • plateifu (str) – The plate-ifu of the Plate to load
  • filename (str) – The path of the file containing the data cube to load.
  • mode ({'local', 'remote', 'auto'}) – The load mode to use. See Mode secision tree..
  • release (str) – The MPL/DR version of the data to use.
  • nocubes (bool) – Set this to turn off the Cube loading
Variables:
  • cubeXXXX (object) – The Marvin Cube object for the given ifu, e.g. cube1901 refers to the Cube for plateifu 8485-1901
  • plate/plateid (int) – The plate id for this plate
  • cartid (str) – The cart id for this plate
  • designid (int) – The design id for this plate
  • ra (float) – The RA of the plate center
  • dec (float) – The declination of the plate center
  • dateobs (str) – The date of observation for this plate
  • surveymode (str) – The survey mode for this plate
  • isbright (bool) – True if this is a bright time plate
Returns:

plate – An object representing the Plate entity. The object is a list of Cube objects, one for each IFU cube in the Plate entity.

Example

>>> from marvin.tools.plate import Plate
>>> plate = Plate(plate=8485)
>>> print(plate)
>>> <Marvin Plate (plate=8485, n_cubes=17, mode='local', data_origin='db')>
>>>
>>> print('Cubes found in this plate: {0}'.format(len(plate)))
>>> Cubes found in this plate: 4
>>>
>>> # access the plate via index to access the individual cubes
>>> plate[0]
>>> <Marvin Cube (plateifu='8485-12701', mode='local', data_origin='db')>
>>>
>>> # or by name
>>> plate['12702']
>>> <Marvin Cube (plateifu='8485-12702', mode='local', data_origin='db')>
>>>

RSS

class marvin.tools.rss.RSS(input=None, filename=None, mangaid=None, plateifu=None, mode=None, data=None, release=None, autoload=True, drpall=None, download=None, nsa_source='auto')[source]

Bases: marvin.tools.core.MarvinToolsClass, marvin.tools.mixins.nsa.NSAMixIn, list

A class to interface with a MaNGA DRP row-stacked spectra file.

This class represents a fully reduced DRP row-stacked spectra object, initialised either from a file, a database, or remotely via the Marvin API. Instances of RSS are a list of RSSFiber objects, one for each fibre and exposure. RSSFiber are initialised lazily, containing only basic information. They need to be initialised by calling RSSFiber.load (unless RSS.autoload is True, in which case the instance is loaded when first accessed).

In addition to the input arguments supported by MarvinToolsClass and NSAMixIn, this class accepts an autoload keyword argument that defines whether RSSFiber objects should be automatically loaded when they are accessed.

download()[source]

Downloads the cube using sdss_access - Rsync

getCube()[source]

Returns the Cube associated with this RSS.

load_all()[source]

Loads all the RSSFiber associated to this RSS instance.

select_fibers(exposure_no=None, set=None, mjd=None)[source]

Selects fibres that match one or multiple of the input parameters.

Parameters:
  • exposure_no (int) – The exposure number. Ignored if None.
  • set (int) – The set id of the exposure. Ignored if None.
  • mjd (int) – The MJD of the exposure. Ignored if None.
Returns:

rssfibers (list) – A list of RSSFiber instances whose obsinfo matches all the input parameters. The RSS.autoload option is respected.

Example

>>> rss = marvin.tools.RSS('8485-1901')
>>> fibers = rss.select_fibers(set=2)
>>> fibers
[<RSSFiber [ 2.22306705, 11.84955406,  9.65761662, ...,  0.        ,
             0.        ,  0.        ] 1e-17 erg / (Angstrom cm2 fiber s)>,
<RSSFiber [2.18669987, 1.4861778 , 2.55065155, ..., 0.        , 0.        ,
           0.        ] 1e-17 erg / (Angstrom cm2 fiber s)>,
<RSSFiber [2.75228763, 5.53485441, 2.31695175, ..., 0.        , 0.        ,
           0.        ] 1e-17 erg / (Angstrom cm2 fiber s)>]
autoload = None

If True, unloaded RSSFiber instances are automatically loaded when accessed. Otherwise, they need to be loaded via RSSFiber.load.

obsinfo = None

An astropy.table.Table with the observing information associated with this RSS object.

class marvin.tools.rss.RSSFiber(fiberid, rss, wavelength, pixmask_flag=None, load=False, obsinfo=None, **kwargs)[source]

Bases: marvin.tools.quantities.spectrum.Spectrum

A Quantity representing a fibre observation.

Represents the spectral flux observed though a fibre, and associated with an RSS object. In addition to the flux, it contains information about the inverse variance, mask, and other associated spectra defined in the datamodel.

Parameters:
  • fiberid (int) – The fiberid (0-indexed row in the parent RSS object) for this fibre observation.
  • rss (RSS) – The parent RSS object with which this fibre observation is associated.
  • wavelength (numpy.ndarray) – The wavelength positions of each array element, in Angstrom.
  • load (bool) – Whether the information in the RSSFiber should be loaded during instantiation. Defaults to lazy loading (use RSSFiber.load to load the fibre information).
  • obsinfo (astropy.table.Table) – A Table with the information for the exposure to which this fibre observation belongs.
  • kwargs (dict) – Additional keyword arguments to be passed to Spectrum.
descale()[source]

Returns a copy of the object in which the scale is unity.

Note that this only affects to the core value of this quantity. Associated array attributes will not be modified.

Example

>>> fiber.unit
Unit("1e-17 erg / (Angstrom cm2 fiber s)")
>>> fiber[100]
<RSSFiber 0.270078063011169 1e-17 erg / (Angstrom cm2 fiber s)>
>>> fiber_descaled = fiber.descale()
>>> fiber_descaled.unit
Unit("Angstrom cm2 fiber s")
>>> fiber[100]
<RSSFiber 2.70078063011169e-18 erg / (Angstrom cm2 fiber s)>
load()[source]

Loads the fibre information.

masked

Return a masked array where the mask is greater than zero.

Maps

class marvin.tools.maps.Maps(input=None, filename=None, mangaid=None, plateifu=None, mode=None, data=None, release=None, drpall=None, download=None, nsa_source='auto', bintype=None, template=None, template_kin=None)[source]

Bases: marvin.tools.core.MarvinToolsClass, marvin.tools.mixins.nsa.NSAMixIn, marvin.tools.mixins.dapall.DAPallMixIn, marvin.tools.mixins.aperture.GetApertureMixIn

A class that represents a DAP MAPS file.

Provides access to the data stored in a DAP MAPS file. In addition to the parameters and variables defined for MarvinToolsClass, the following parameters and attributes are specific to Maps.

Parameters:
  • bintype (str or None) – The binning type. For MPL-4, one of the following: 'NONE', 'RADIAL', 'STON' (if None defaults to 'NONE'). For MPL-5, one of, 'ALL', 'NRE', 'SPX', 'VOR10' (defaults to 'SPX'). MPL-6 also accepts the 'HYB10' binning schema.
  • template (str or None) – The stellar template used. For MPL-4, one of 'M11-STELIB-ZSOL', 'MILES-THIN', 'MIUSCAT-THIN' (if None, defaults to 'MIUSCAT-THIN'). For MPL-5 and successive, the only option in 'GAU-MILESHC' (None defaults to it).
Variables:
download()[source]

Downloads the maps using sdss_access - Rsync

getCube()[source]

Returns the Cube for with this Maps.

getMap(property_name, channel=None, exact=False)[source]

Retrieves a Map object.

Parameters:
  • property_name (str) – The property of the map to be extractred. It may the name of the channel (e.g. 'emline_gflux_ha_6564') or just the name of the property ('emline_gflux').
  • channel (str or None) – If defined, the name of the channel to be appended to property_name (e.g., 'ha_6564').
  • exact (bool) – If exact=False, fuzzy matching will be used, retrieving the best match for the property name and channel. If True, will check that the name of returned map matched the input value exactly.
getMapRatio(property_name, channel_1, channel_2)[source]

Returns a ratio Map.

Attention

Deprecated, see Enhanced Map.

For a given property_name, returns a Map which is the ratio of channel_1/channel_2.

For a given property_name, returns a Map which is the ratio of channel_1/channel_2.

Parameters:
  • property_name (str) – The property_name of the map to be extractred. E.g., 'emline_gflux'.
  • channel_1,channel_2 (str) – The channels to use.
getModelCube()[source]

Returns the ModelCube for with this Maps.

getSpaxel(x=None, y=None, ra=None, dec=None, cube=False, modelcube=False, **kwargs)[source]

Returns the Spaxel matching certain coordinates.

The coordinates of the spaxel to return can be input as x, y pixels relative to``xyorig`` in the cube, or as ra, dec celestial coordinates.

If spectrum=True, the returned Spaxel will be instantiated with the DRP spectrum of the spaxel for the DRP cube associated with this Maps.

Parameters:
  • x,y (int or array) – The spaxel coordinates relative to xyorig. If x is an array of coordinates, the size of x must much that of y.
  • ra,dec (float or array) – The coordinates of the spaxel to return. The closest spaxel to those coordinates will be returned. If ra is an array of coordinates, the size of ra must much that of dec.
  • xyorig ({'center', 'lower'}) – The reference point from which x and y are measured. Valid values are 'center' (default), for the centre of the spatial dimensions of the cube, or 'lower' for the lower-left corner. This keyword is ignored if ra and dec are defined.
  • cube (bool) – If True, the Spaxel will be initialised with the corresponding DRP cube data.
  • modelcube (bool) – If True, the Spaxel will be initialised with the corresponding ModelCube data.
Returns:

spaxels (list) – The Spaxel objects for this cube/maps corresponding to the input coordinates. The length of the list is equal to the number of input coordinates.

get_binid(property=None)[source]

Returns the binid map associated with a property.

Parameters:property (datamodel.Property or None) – The property for which the associated binid map will be returned. If binid=None, the default binid is returned.
Returns:binid (Map) – A Map with the binid associated with property or the default binid.
get_bpt(method='kewley06', snr_min=3, return_figure=True, show_plot=True, use_oi=True, **kwargs)[source]

Returns the BPT diagram for this target.

This method produces the BPT diagram for this target using emission line maps and returns a dictionary of classification masks, that can be used to select spaxels that have been classified as belonging to a certain excitation process. It also provides plotting functionalities.

Extensive documentation can be found in BPT Diagrams.

Parameters:
  • method ({'kewley06'}) – The method used to determine the boundaries between different excitation mechanisms. Currently, the only available method is 'kewley06', based on Kewley et al. (2006). Other methods may be added in the future. For a detailed explanation of the implementation of the method check the BPT documentation.
  • snr_min (float or dict) – The signal-to-noise cutoff value for the emission lines used to generate the BPT diagram. If snr_min is a single value, that signal-to-noise will be used for all the lines. Alternatively, a dictionary of signal-to-noise values, with the emission line channels as keys, can be used. E.g., snr_min={'ha': 5, 'nii': 3, 'oi': 1}. If some values are not provided, they will default to SNR>=3.
  • return_figure (bool) – If True, it also returns the matplotlib Figure of the BPT diagram plot, which can be used to modify the style of the plot.
  • show_plot (bool) – If True, interactively display the BPT plot.
  • use_oi (bool) – If True, turns uses the OI diagnostic line in classifying BPT spaxels
Returns:

bpt_returnget_bpt always returns a dictionary of classification masks. These classification masks (not to be confused with bitmasks) are boolean arrays with the same shape as the Maps or Cube (without the spectral dimension) that can be used to select spaxels belonging to a certain excitation process (e.g., star forming). The keys of the dictionary, i.e., the classification categories, may change depending on the selected method. Consult the BPT documentation for more details. If return_figure=True, ~.Maps.get_bpt will also return the matplotlib Figure for the generated plot, and a list of axes for each one of the subplots.

Example

>>> cube = Cube(plateifu='8485-1901')
>>> maps = cube.getMaps()
>>> bpt_masks, bpt_figure = maps.get_bpt(snr=5, return_figure=True,
>>>                                      show_plot=False)

Now we can use the masks to select star forming spaxels from the cube

>>> sf_spaxels = cube.flux[bpt_masks['sf']['global']]

And we can save the figure as a PDF

>>> bpt_figure.savefig('8485_1901_bpt.pdf')
get_unbinned()[source]

Returns a version of self corresponding to the unbinned Maps.

is_binned()[source]

Returns True if the Maps is not unbinned.

to_dataframe(columns=None, mask=None)[source]

Converts the maps object into a Pandas dataframe.

Parameters:
  • columns (list) – The properties+channels you want to include. Defaults to all of them.
  • mask (array) – A 2D mask array for filtering your data output
Returns:

df (DataFrame) – A Pandas DataFrame.

Model Cube

class marvin.tools.modelcube.ModelCube(input=None, filename=None, mangaid=None, plateifu=None, mode=None, data=None, release=None, drpall=None, download=None, nsa_source='auto', bintype=None, template=None, template_kin=None)[source]

Bases: marvin.tools.core.MarvinToolsClass, marvin.tools.mixins.nsa.NSAMixIn, marvin.tools.mixins.dapall.DAPallMixIn, marvin.tools.mixins.aperture.GetApertureMixIn

A class to interface with MaNGA DAP model cubes.

This class represents a DAP model cube, initialised either from a file, a database, or remotely via the Marvin API. In addition to the parameters and variables defined for MarvinToolsClass, the following parameters and attributes are specific to Maps.

Parameters:
  • bintype (str or None) – The binning type. For MPL-4, one of the following: 'NONE', 'RADIAL', 'STON' (if None defaults to 'NONE'). For MPL-5, one of, 'ALL', 'NRE', 'SPX', 'VOR10' (defaults to 'SPX'). MPL-6 also accepts the 'HYB10' binning schema.
  • template (str or None) – The stellar template used. For MPL-4, one of 'M11-STELIB-ZSOL', 'MILES-THIN', 'MIUSCAT-THIN' (if None, defaults to 'MIUSCAT-THIN'). For MPL-5 and successive, the only option in 'GAU-MILESHC' (None defaults to it).
Variables:
download()[source]

Downloads the cube using sdss_access - Rsync

getCube()[source]

Returns the associated Cube.

getMaps()[source]

Returns the associated`~marvin.tools.maps.Maps`.

getSpaxel(x=None, y=None, ra=None, dec=None, cube=False, maps=False, **kwargs)[source]

Returns the Spaxel matching certain coordinates.

The coordinates of the spaxel to return can be input as x, y pixels relative to``xyorig`` in the cube, or as ra, dec celestial coordinates.

If spectrum=True, the returned Spaxel will be instantiated with the DRP spectrum of the spaxel for the DRP cube associated with this ModelCube. The same is true for properties=True for the DAP properties of the spaxel in the Maps associated with these coordinates.

Parameters:
  • x,y (int or array) – The spaxel coordinates relative to xyorig. If x is an array of coordinates, the size of x must much that of y.
  • ra,dec (float or array) – The coordinates of the spaxel to return. The closest spaxel to those coordinates will be returned. If ra is an array of coordinates, the size of ra must much that of dec.
  • xyorig ({'center', 'lower'}) – The reference point from which x and y are measured. Valid values are 'center' (default), for the centre of the spatial dimensions of the cube, or 'lower' for the lower-left corner. This keyword is ignored if ra and dec are defined.
  • cube (bool) – If True, the Spaxel will be initialised with the corresponding DRP cube data.
  • maps (bool) – If True, the Spaxel will be initialised with the corresponding DAP Maps properties for this spaxel.
Returns:

spaxels (list) – The Spaxel objects for this cube/maps corresponding to the input coordinates. The length of the list is equal to the number of input coordinates.

get_binid(model=None)[source]

Returns the binid map associated with a model.

Parameters:model (datamodel.Model or None) – The model for which the associated binid map will be returned. If binid=None, the default binid is returned.
Returns:binid (Map) – A Map with the binid associated with model or the default binid.
get_unbinned()[source]

Returns a version of self corresponding to the unbinned ModelCube.

is_binned()[source]

Returns True if the ModelCube is not unbinned.

binned_flux

Returns the binned flux datacube.

emline_fit

Returns the emission line fit.

full_fit

Returns the full fit datacube.

stellarcont_fit

Returns the stellar continuum fit.

Spaxel

class marvin.tools.spaxel.Spaxel(x, y, cube=True, maps=True, modelcube=True, lazy=False, **kwargs)[source]

Bases: object

A base class that contains information about a spaxel.

This class represents an spaxel with information from the reduced DRP spectrum, the DAP maps properties, and the model spectrum from the DAP logcube. A SpaxelBase can be initialised with all or only part of that information, and either from a file, a database, or remotely via the Marvin API.

The Cube, Maps , and ModelCube quantities for the spaxel are available in cube_quantities, maps_quantities, and modelcube_quantities, respectively. For convenience, the quantities can also be accessed directly from the SpaxelBase itself (e.g., spaxel.emline_gflux_ha_6465).

Parameters:
  • x,y (int) – The x and y coordinates of the spaxel in the cube (0-indexed).
  • cube (Cube object or path or bool) – If cube is a Cube object, that cube will be used for the SpaxelBase instantiation. This mode is mostly intended for getSpaxel as it significantly improves loading time. Otherwise, cube can be True (default), in which case a cube will be instantiated using the input filename, mangaid, or plateifu. If cube=False, no cube will be used and the cube associated quantities will not be available. cube can also be the path to the DRP cube to use.
  • maps (Maps object or path or bool) – As cube but for the DAP measurements corresponding to the spaxel in the Maps.
  • modelcube (marvin.tools.modelcube.ModelCube object or path or bool) – As maps but for the DAP measurements corresponding to the spaxel in the ModelCube.
  • lazy (bool) – If False, the spaxel data is loaded on instantiation. Otherwise, only the metadata is created. The associated quantities can be then loaded by calling SpaxelBase.load().
  • kwargs (dict) – Arguments to be passed to Cube, Maps, and ModelCube when (and if) they are initialised.
Variables:
  • cube_quantities (FuzzyDict) – A querable dictionary with the Spectrum quantities derived from Cube and matching x, y.
  • datamodel (object) – An object containing the DRP and DAP datamodels.
  • maps_quantities (FuzzyDict) – A querable dictionary with the AnalysisProperty quantities derived from Maps and matching x, y.
  • model_quantities (FuzzyDict) – A querable dictionary with the Spectrum quantities derived from ModelCube and matching x, y.
  • ra,dec (float) – Right ascension and declination of the spaxel. Not available until the spaxel has been loaded.
getCube()[source]

Returns the associated Cube

getMaps()[source]

Returns the associated Maps

getModelCube()[source]

Returns the associated ModelCube

load(force=None)[source]

Loads the spaxel data.

Loads the spaxel data for cubes/maps/modelcube. By default attempts to load whatever is specified when spaxels are instantianted from other Marvin Tools. Can manually force load a data type with the force keyword.

force : {cube|maps|modelcube}
Datatype to force load.
classmethod restore(path, delete=False)[source]

Restores a Spaxel object from a pickled file.

If delete=True, the pickled file will be removed after it has been unplickled. Note that, for objects with data_origin='file', the original file must exists and be in the same path as when the object was first created.

save(path, overwrite=False)[source]

Pickles the spaxel to a file.

Parameters:
  • path (str) – The path of the file to which the Spaxel will be saved. Unlike for other Marvin Tools that derive from MarvinToolsClass, path is mandatory for Spaxel.save as there is no default path for a given spaxel.
  • overwrite (bool) – If True, and the path already exists, overwrites it. Otherwise it will fail.
Returns:

path (str) – The realpath to which the file has been saved.

quality_flags

Bundle Cube DRP3QUAL and Maps DAPQUAL flags.

BinInfo

Provides information about the bin associated with this quantity.

class marvin.tools.quantities.base_quantity.BinInfo(spaxel=None, parent=None, datamodel=None)[source]

Provides information about the bin associated with this quantity.

Image

class marvin.tools.image.Image(input=None, filename=None, mangaid=None, plateifu=None, mode=None, data=None, release=None, download=None)[source]

Bases: marvin.tools.mixins.mma.MMAMixIn

A class to interface with MaNGA images.

This class represents a MaNGA image object initialised either from a file, or remotely via the Marvin API.

TODO: what kinds of images should this handle? optical, maps, nsa preimaging? TODO: should this be subclasses into different kinds of images? DRPImage, MapImage, NSAImage?

Variables:
classmethod by_plate(plateid, minis=None, release=None)[source]

Generate a list of Marvin Images by plate

Class method to generate a list of Marvin Images from a single plateid.

Parameters:
  • plateid (int) – The plate id to grab
  • minis (bool) – If True, includes the mini-bundles
  • release (str) – The release of Images to get
Returns:

a list of Marvin Image objects

Example

>>> from marvin.tools.image import Image
>>> images = Image.by_plate(8485)
close()[source]

Slose the image

download()[source]

Downloads the image using sdss_access - Rsync,

classmethod from_list(values, release=None)[source]

Generate a list of Marvin Image objects

Class method to generate a list of Marvin Images from an input list of targets

Parameters:
  • values (list) – A list of target ids (i.e. plateifus, mangaids, or filenames)
  • release (str) – The release of Images to get
Returns:

a list of Marvin Image objects

Example

>>> from marvin.tools.image import Image
>>> targets = ['8485-1901', '7443-1201']
>>> images = Image.from_list(targets)
getCube()[source]

Returns the Cube for this Image.

getMaps(**kwargs)[source]

Retrieves the DAP Maps for this Image.

If called without additional kwargs, getMaps() will initialize the Maps using the plateifu of this Image. Otherwise, the kwargs will be passed when initialising the Maps.

get_new_cutout(width, height, scale=None, **kwargs)[source]

Get a new Image Cutout using Skyserver

Replaces the current Image with a new image cutout. The data, header, and wcs attributes are updated accordingly.

Parameters:
  • width (int) – Cutout image width in arcsec
  • height (int) – Cutout image height in arcsec
  • scale (float) – arcsec/pixel scale of the image
  • kwargs – Any additional keywords for Cutout
classmethod get_random(num=5, minis=None, release=None)[source]

Generate a set of random Marvin Images

Class method to generate a random list of Marvin Images

Parameters:
  • num (int) – The number to grab. Default is 5
  • minis (bool) – If True, includes the mini-bundles
  • release (str) – The release of Images to get
Returns:

a list of Marvin Image objects

Example

>>> from marvin.tools.image import Image
>>> images = Image.get_random(5)
overlay_fibers(ax, diameter=None, skies=None, return_figure=True, **kwargs)[source]

Overlay the individual fibers within an IFU on a plot.

Parameters:
  • ax (Axis) – The matplotlib axis object
  • diameter (float) – The fiber diameter in arcsec. Default is 2”.
  • skies (bool) – Set to True to additionally overlay the sky fibers. Default if False
  • return_figure (bool) – If True, returns the figure axis object. Default is True
  • kwargs – Any keyword arguments accepted by Matplotlib EllipseCollection
overlay_hexagon(ax, return_figure=True, **kwargs)[source]

Overlay the IFU hexagon on a plot

Parameters:
  • ax (Axis) – The matplotlib axis object
  • return_figure (bool) – If True, returns the figure axis object. Default is True
  • kwargs – Any keyword arguments accepted by Matplotlib plot
overlay_skies(ax, diameter=None, return_figure=True, **kwargs)[source]

Overlay the sky fibers on a plot

Parameters:
  • ax (Axis) – The matplotlib axis object
  • diameter (float) – The fiber diameter in arcsec
  • return_figure (bool) – If True, returns the figure axis object. Default is True
  • kwargs – Any keyword arguments accepted by Matplotlib EllipseCollection
plot(return_figure=True, dpi=100, with_axes=None, fibers=None, skies=None, **kwargs)[source]

Creates a Matplotlib plot the image

Parameters:
  • fibers (bool) – If True, overlays the fiber positions. Default is False.
  • skies (bool) – If True, overlays the sky fibers if possible. Default is False.
  • return_figure (bool) – If True, returns the figure axis object. Default is True
  • dpi (int) – The dots per inch for the matplotlib figure
  • with_axes (bool) – If True, plots the image with axes
  • kwargs – Keyword arguments for overlay_fibers and overlay_skies
save(filename, filetype='png', **kwargs)[source]

Save the image to a file

This only saves the original image. To save the Matplotlib plot, use the savefig method on the matplotlib.pyplot.figure object

Parameters:
  • filename (str) – The filename of the output image
  • filetype (str) – The filetype, e.g. png
  • kwargs – Additional keyword arguments to the PIL.Image.save method
show()[source]

Show the image

url

VACs

class marvin.tools.vacs.VACDataClass(name, description, path)[source]

Bases: object

A data class for a given VAC

Parameters:
  • name (str) – The name of the VAC
  • description (str) – The description of the VAC
  • path (str) – The full path to the VAC summary file
Variables:
  • name (str) – The name of the VAC
  • description (str) – The description of the VAC
  • data (HDUList) – The Astropy FITS HDUList

Example

>>> from marvin.tools.vacs import VACs
>>> vacs = VACs()
>>> vacs.galaxyzoo.data
>>> vacs.galaxyzoo.get_table(ext=1)
download_vac()[source]

Download a VAC to the local system

get_table(ext=None)[source]

Create an Astropy table for a data extension

Parameters:ext (int|str) – The HDU extension name or number
Returns:An Astropy table for the given extension
has_target(target)[source]

Checks if a target is contained within the VAC

Parameters:target (str) – The name of the target
Returns:A boolean indicating if the target is in the VAC or not
info()[source]

print the VAC HDU info

data

The VAC FITS data

class marvin.tools.vacs.VACs[source]

Bases: marvin.contrib.vacs.base.VACContainer

A class to interface with the MaNGA VACs

A container class to interact with all MaNGA VACs that have been contributed into Marvin. Currently, this container only works with local VACs. Remote-only access to VACs currently does not exist.

Variables:
  • release (str) – The current MPL/DR version of the loaded VACs
  • vacname (object) – A specific VAC object. “vacname” is the name of the VAC, e.g. galaxyzoo

Example

>>> from marvin.tools.vacs import VACs
>>> vacs = VACs()
check_target(target)[source]

check which VACS a MaNGA target is available in

Checks for the target in each VAC and returns a dictionary of VAC names and a boolean indicating if the target is in that VAC

Parameters:target (str) – The name of the target
Returns:A dict of booleans
list_vacs()[source]

list the available VACS

class marvin.tools.vacs.check_vac_release(*args, **kwargs)[source]

Bases: object

Decorate all functions in a class to run only if VAC release matches Marvin release

marvin.tools.vacs.check_release(*args, **kwargs)[source]

Decorator to check VAC release against Marvin config release