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.
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
.
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: |
|
---|---|
Returns: | spaxels (list) – The |
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: |
|
---|---|
Variables: |
|
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')>
>>>
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.
select_fibers
(exposure_no=None, set=None, mjd=None)[source]¶Selects fibres that match one or multiple of the input parameters.
Parameters: | |
---|---|
Returns: | rssfibers (list) – A list of |
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.
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: |
|
---|
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)>
masked
¶Return a masked array where the mask is greater than zero.
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: |
|
---|---|
Variables: |
|
getMap
(property_name, channel=None, exact=False)[source]¶Retrieves a Map
object.
Parameters: |
|
---|
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: |
---|
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: |
|
---|---|
Returns: | spaxels (list) – The |
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: |
|
---|---|
Returns: | bpt_return – |
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')
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: |
|
---|---|
Variables: |
|
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: |
|
---|---|
Returns: | spaxels (list) – The |
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. |
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.
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: |
|
---|---|
Variables: |
|
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.
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: |
|
---|---|
Returns: | path (str) – The realpath to which the file has been saved. |
quality_flags
¶Bundle Cube DRP3QUAL and Maps DAPQUAL flags.
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: |
|
---|
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: | |
---|---|
Returns: | a list of Marvin Image objects |
Example
>>> from marvin.tools.image import Image
>>> images = Image.by_plate(8485)
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: | |
---|---|
Returns: | a list of Marvin Image objects |
Example
>>> from marvin.tools.image import Image
>>> targets = ['8485-1901', '7443-1201']
>>> images = Image.from_list(targets)
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: |
---|
get_random
(num=5, minis=None, release=None)[source]¶Generate a set of random Marvin Images
Class method to generate a randome list of Marvin Images
Parameters: | |
---|---|
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: |
|
---|
overlay_hexagon
(ax, return_figure=True, **kwargs)[source]¶Overlay the IFU hexagon on a plot
Parameters: |
|
---|
overlay_skies
(ax, diameter=None, return_figure=True, **kwargs)[source]¶Overlay the sky fibers on a plot
Parameters: |
---|
plot
(return_figure=True, dpi=100, with_axes=None, fibers=None, skies=None, **kwargs)[source]¶Creates a Matplotlib plot the image
Parameters: |
|
---|