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.core.core.MarvinToolsClass
, marvin.core.core.NSAMixIn
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
for a list of parameters. In addition to the
attributes defined there
, the following ones are
also defined
Variables: |
|
---|
getAperture
(coords, radius, mode='pix', weight=True, return_type='mask')[source]¶Returns the spaxel in a circular or elliptical aperture.
Returns either a mask of the same shape as the cube with the spaxels within an aperture, or the integrated spaxel from combining the spectra for those spaxels.
The centre of the aperture is defined by coords
, which must be a
tuple of (x,y)
(if mode='pix'
) or (ra,dec)
coordinates
(if mode='sky'
). radius
defines the radius of the circular
aperture, or the parameters of the aperture ellipse.
If weight=True
, the returned mask indicated the fraction of the
spaxel encompassed by the aperture, ranging from 0 for spaxels not
included to 1 for pixels totally included in the aperture. This
weighting is used to return the integrated spaxel.
Parameters: |
|
---|---|
Returns: | result – If |
Example
To get the mask for a circular aperture centred in spaxel (5, 7) and with radius 5 spaxels
>>> mask = cube.getAperture((5, 7), 5)
>>> mask.shape
(34, 34)
If you want to get the spaxels associated with that mask
>>> mask, spaxels = cube.getAperture((5, 7), 5, return_type='spaxels')
>>> len(spaxels)
15
getMaps
(**kwargs)[source]¶Retrieves the DAP Maps
for this cube.
If called without additional kwargs
, getMaps()
will initilise
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, properties=True, models=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 |
manga_target1
¶Return MANGA_TARGET1 flag.
manga_target2
¶Return MANGA_TARGET2 flag.
manga_target3
¶Return MANGA_TARGET3 flag.
pixmask
¶Return the DRP3PIXMASK flag.
quality_flag
¶Return ModelCube DAPQUAL flag.
target_flags
¶Bundle MaNGA targeting flags.
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.core.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
(*args, **kwargs)[source]¶Bases: marvin.core.core.MarvinToolsClass
, list
A class to interface with MaNGA RSS data.
This class represents a fully reduced RSS file, 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 RSSFiber objects.
Parameters: |
|
---|---|
Returns: | rss – An object representing the RSS entity. The object is a list of RSSFiber objects, one for each fibre in the RSS entity. |
marvin.tools.rss.
RSSFiber
(*args, **kwargs)[source]¶Bases: marvin.tools.quantities.spectrum.Spectrum
A class to represent a MaNGA RSS fiber.
This class is basically a subclass of Spectrum
with additional
functionality. It is not intended to be initialised directly, but via
the RSS._initFibers()
method.
Parameters: |
|
---|---|
Returns: | rssfiber – An object representing the RSS fiber entity. |
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.core.core.MarvinToolsClass
, marvin.core.core.NSAMixIn
, marvin.core.core.DAPallMixIn
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]¶Deprecated, see Enhanced Map. Returns a ratio Map
.
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, drp=True, model=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
(binid=None)[source]¶Returns a 2D array containing the binid map.
In MPL-6
, binid
can be used to specify the binid property
to return. If binid=None
, the default binid is returned.
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')
to_dataframe
(columns=None, mask=None)[source]¶Converts the maps object into a Pandas dataframe.
Parameters: |
|
---|---|
Returns: |
manga_target1
¶Return MANGA_TARGET1 flag.
manga_target2
¶Return MANGA_TARGET2 flag.
manga_target3
¶Return MANGA_TARGET3 flag.
quality_flag
¶Return Maps DAPQUAL flag.
target_flags
¶Bundle MaNGA targeting flags.
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.core.core.MarvinToolsClass
, marvin.core.core.NSAMixIn
, marvin.core.core.DAPallMixIn
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, drp=True, properties=True, **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 |
binned_flux
¶Returns the binned flux datacube.
emline_fit
¶Returns the emission line fit.
full_fit
¶Returns the full fit datacube.
manga_target1
¶Return MANGA_TARGET1 flag.
manga_target2
¶Return MANGA_TARGET2 flag.
manga_target3
¶Return MANGA_TARGET3 flag.
pixmask
¶Return the DAPSPECMASK flag.
quality_flag
¶Return ModelCube DAPQUAL flag.
stellarcont_fit
¶Returns the stellar continuum fit.
target_flags
¶Bundle MaNGA targeting flags.
marvin.tools.spaxel.
SpaxelBase
(x, y, mangaid=None, plateifu=None, 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/modelcubes. 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.
Parameters: | force ({cube|maps|models}) – Str datatype to force load |
---|
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. |
bintype
¶Returns the bintype.
manga_target1
¶Return MANGA_TARGET1 flag.
manga_target2
¶Return MANGA_TARGET2 flag.
manga_target3
¶Return MANGA_TARGET3 flag.
mangaid
¶Returns the mangaid.
plateifu
¶Returns the plateifu.
quality_flags
¶Bundle Cube DRP3QUAL and Maps DAPQUAL flags.
release
¶Returns the release.
target_flags
¶Bundle MaNGA targeting flags.
template
¶Returns the template.
marvin.tools.spaxel.
Spaxel
(*args, **kwargs)[source]¶Bases: marvin.tools.spaxel.SpaxelBase
A class representing an unbinned spaxel.
This subclass of SpaxelBase
represents an spaxel belonging to an
unbinned Maps
and ModelCube
.
If initialised directly, a Spaxel
will fail if the input data correspond
to a binned maps or modelcube object.
Refer to the documentation of SpaxelBase
for information about the valid
parameters and methods.