Contributed VACs

Base Classes

class marvin.contrib.vacs.base.VACMixIn[source]

MixIn that allows VAC integration in Marvin.

This parent class provides common tools for downloading data using sdss_access or directly from the sandbox. get_vacs returns a container with properties pointing to all the VACs that subclass from VACMixIn. In general, VACs can be added to a class in the following way:

from marvin.contrib.vacs.base import VACMixIn

class Maps(MarvinToolsClass):

    def __init__(self, *args, **kwargs):

        ...

        self.vacs = VACMixIn.get_vacs(self)

and then the VACs can be accessed as properties in my_map.vacs.

check_vac(summary_file)[source]

Checks the summary file for existence

download_vac(name=None, path_params={}, verbose=True)[source]

Download the VAC using rsync and returns the local path.

file_exists(path=None, name=None, path_params={})[source]

Check whether a file exists locally

get_ancillary_file(name, path_params={})[source]

Get a path to an ancillary VAC file

get_path(name=None, path_params={})[source]

Returns the local VAC path or False if it does not exist.

abstract get_target(parent_object)[source]

Returns VAC data that matches the parent_object target.

This method must be overridden in each subclass of VACMixIn. Details will depend on the exact implementation and the type of VAC, but in general each version of this method must:

  • Check whether the VAC file exists locally.

  • If it does not, download it using download_vac.

  • Open the file using the appropriate library.

  • Retrieve the VAC data matching parent_object. Usually one will use attributes in parent_object such as .mangaid or .plateifu to perform the match.

  • Return the VAC data in whatever format is appropriate.

static get_vacs(parent_object)[source]

Returns a container with all the VACs subclassing from VACMixIn.

Because this method loops over VACMixIn.__subclasses__(), all the class that inherit from VACMixIn and that must be included in the container need to have been imported before calling get_vacs.

Parameters

parent_object (object) – The object to which the VACs are being attached. It will be passed to get_target when the subclass of VACMixIn is called.

Returns

vac_container (object) – An instance of a class that contains just a list of properties, one for to each on of the VACs that subclass from VACMixIn.

abstract set_summary_file(release)[source]

Sets the VAC summary file

This method must be overridden in each subclass of VACMixIn. Details will depend on the exact implementation and the type of VAC, but in general each version of this method must:

  • Access the version of your VAC matching the current release

  • Define a dictionary of keyword parameters that defines the tree path

  • Use get_path to construct the VAC path

  • Set that path to the summary_file attribute

Setting a VAC summary file allows the VACs tool to load the full VAC data. If the VAC does not contain a summary file, this method should pass or return None.

update_path_params(params)[source]

Update the path_params dictionary with additional parameters

class marvin.contrib.vacs.base.VACTarget(targetid, vacfile, **kwargs)[source]

Customization Class to allow for returning complex target data

This parent class provides a framework for returning more complex data associated with a given target observation, for example ancillary spectral or image data. In these cases, returning a target row from the main VAC summary file, or a simple dictionary of values may not be sufficient. This class can be subclassed and customized to return any extra functionality or data.

When used, this class provides convenient access to the underlying VAC data as well as a boolean to indicate if the given target is included in the VAC.

Parameters
  • targetid (str) – The target id, usually plateifu or mangaid. Required.

  • vacfile (str) – The path to the VAC summary file. Required.

Variables
  • targetid (str) – The plateifu or mangaid target designation

  • data (row) – The extracted row VAC data for the provided targetid

  • _data (HDU) – the first data HDU of the summary VAC FITS file

  • _indata (bool) – A boolean indicating if the target is included in the VAC

To use, subclass this class, add a new __init__ method. Make sure to call the original class’s __init__ method with super.

from marvin.contrib.vacs.base import VACTarget

class ExampleTarget(VACTarget):

    def __init__(self, targetid, vacfile):
        super(ExampleTarget, self).__init__(targetid, vacfile)

Further customization can now be done, e.g. adding new parameters in the initializtion of the object, adding new methods or attributes, or overriding existing methods, e.g. to customize the return data attribute.

To access a single HDU from the VAC, use the _get_data() method. If you need to access the entire file, use the _open_file() method.

property data

The data row from a VAC for a specific targetid

Available VACs

Galaxy Zoo

class marvin.contrib.vacs.galaxyzoo.GZVAC[source]

Bases: VACMixIn

Provides access to the MaNGA Galaxy Zoo Morphology VAC.

VAC name: MaNGA Morphologies from Galaxy Zoo

URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo

Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (GZ) data for SDSS galaxies has been split over several iterations of www.galaxyzoo.org, with the MaNGA target galaxies being spread over five different GZ data sets. In this value added catalog, for DR15, we bring all of these galaxies into one single catalog and re-run the debiasing code (Hart et al. 2016) in a consistent manner across the all the galaxies. This catalog includes data from Galaxy Zoo 2 (previously published in Willett et al. 2013) and newer data from Galaxy Zoo 4 (currently unpublished).

For DR17, we provide new and updated Galaxy Zoo (GZ) data for the final MaNGA galaxies. This has been split over three files, each corresponding to a separate GZ catalogue. We have MaNGA_GZD_auto-v1_0_1.fits, which corresponds to the automated classifications GZ DECaLS, described in Walmsley et al. 2021. There is also MaNGA_gzUKIDSS-v1_0_1.fits, which correponds to GZ:UKIDSS. Finally, we have put the rest of GZ (so not including GZ DECaLS and GZ:UKIDSS) in MaNGA_gz-v2_0_1.fits. For more information, please refer to the datamodels provided.

Authors: Coleman Krawczyk, Karen Masters, Tobias Géron and the rest of the Galaxy Zoo Team.

get_target(parent_object)[source]

Accesses VAC data for a specific target from a Marvin Tool object

set_summary_file(release)[source]

Sets the path to the GalaxyZoo summary file.

Sets the paths to the GalaxyZoom summary file(s). For DR15 this is a single summary file, while for DR17, this has been split into three files, so self.summary_file and self.path_params return lists for DR17.

HI

class marvin.contrib.vacs.hi.HITarget(targetid, vacfile, specfile=None)[source]

Bases: VACTarget

A customized target class to also display HI spectra

This class handles data from both the HI summary file and the individual spectral files. Row data from the summary file for the given target is returned via the data property. Spectral data can be displayed via the the plot_spectrum method.

Parameters
  • targetid (str) – The plateifu or mangaid designation

  • vacfile (str) – The path of the VAC summary file

  • specfile (str) – The path to the HI spectra

Variables
  • data – The target row data from the main VAC file

  • targetid (str) – The target identifier

plot_spectrum()[source]

Plot the HI spectrum

class marvin.contrib.vacs.hi.HIVAC[source]

Bases: VACMixIn

Provides access to the MaNGA-HI VAC.

VAC name: HI

URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=hi-manga-data-release-1

Description: Returns HI summary data and spectra

Authors: David Stark and Karen Masters

get_target(parent_object)[source]

Accesses VAC data for a specific target from a Marvin Tool object

set_summary_file(release)[source]

Sets the path to the HI summary file

marvin.contrib.vacs.hi.choose_best_spectrum(par1, par2, conf_thresh=0.1)[source]

choose optimal HI spectrum based on the following criteria: (1) If both detected and unconfused, choose highest SNR (2) If both detected and both confused, choose lower confusion prob. (3) If both detected and one confused, choose non-confused (4) If one non-confused detection and one non-detection, go with detection (5) If one confused detetion and one non-detection, go with non-detection (6) If niether detected, choose lowest rms

par1 and par2 are dictionaries with the following parameters: program - gbt or alfalfa snr - integrated SNR rms - rms noise level conf_prob - confusion probability

conf_thresh = maximum confusion probability below which we classify the object as essentially unconfused. Default to 0.1 following (Stark+21)

marvin.contrib.vacs.hi.plot_mass_fraction(vacdata_object)[source]

Plot the HI mass fraction

Computes and plots the HI mass fraction using the NSA elliptical Petrosian stellar mass from the MaNGA DRPall file. Only plots data for subset of targets in both the HI VAC and the DRPall file.

Parameters

vacdata_object (object) – The VACDataClass instance of the HI VAC

Example

>>> from marvin.tools.vacs import VACs
>>> v = VACs()
>>> hi = v.HI
>>> hi.plot_mass_fraction()

Gema

class marvin.contrib.vacs.gema.GEMAVAC[source]

Bases: VACMixIn

Provides access to the MaNGA-GEMA VAC.

VAC name: GEMA

URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=gema-vac:-galaxy-environment-for-manga-value-added-catalog

Description: The GEMA VAC contains many different quantifications of the local and the large-scale environments for MaNGA galaxies. Please visit the DATAMODEL at https://data.sdss.org/datamodel/files/MANGA_GEMA/GEMA_VER to see the description of each table composing the catalogue.

Authors: Maria Argudo-Fernandez, Daniel Goddard, Daniel Thomas, Zheng Zheng, Lihwai Lin, Ting Xiao, Fangting Yuan, Jianhui Lian, et al

get_target(parent_object)[source]

Accesses VAC data for a specific target from a Marvin Tool object

set_summary_file(release)[source]

Sets the path to the GEMA summary file

Firefly

class marvin.contrib.vacs.firefly.CallableDict[source]

Bases: dict

Creates dictionary object with keys that can be called without using round brackets. Enables to execute functions inside the dictionary object implicitly.

class marvin.contrib.vacs.firefly.FFlyTarget(targetid, vacfile, imagesz=None, release='DR17')[source]

Bases: VACTarget

A customized target class to also display Firefly 2-d maps

This class handles data the Firefly summary file. Row data from the summary file for the given target is returned via the data property. Specific Firefly parameters are available via the stellar_pops and stellar_gradients methods, respectively. 2-d maps from the Firefly data can be produced via the plot_map method.

TODO:

Parameters
  • targetid (str) – The plateifu or mangaid designation

  • vacfile (str) – The path of the VAC summary file

  • imagesz (int) – The original array shape of the target cube

Variables
  • data – The target row data from the main VAC file

  • targetid (str) – The target identifier

list_parameters()[source]

List the parameters available for plotting

plot_map(parameter=None, mask=None)[source]

Plot map of stellar population properties

Plots a 2d map of the specified FIREFLY stellar population parameter using Matplotlib. Optionally mask the data when plotting using Numpy’s Masked Array. Default is to mask map values < -10.

Parameters
  • parameter (str) – The named of the VORONOI stellar pop. parameter

  • mask (nd-array) – A Numpy array of masked values to apply to the map

Returns

The matplotlib axis image object

stellar_gradients(parameter=None)[source]

Returns the gradient of stellar population properties

Returns the gradient of the stellar population property for a given stellar population parameter. If no parameter specified, returns the entire row.

Parameters

parameter (str) – The stellar population parameter to retrieve. Can be one of [‘lw_age’, ‘mw_age’, ‘lw_z’, ‘mw_z’].

Returns

The data from the FIREFLY summary file for the target galaxy

stellar_pops(parameter=None)[source]

Returns the global stellar population properties

Returns the global stellar population property within 1 Re for a given stellar population parameter. If no parameter specified, returns the entire row.

Parameters

parameter (str) – The stellar population parameter to retrieve. Can be one of [‘lw_age’, ‘mw_age’, ‘lw_z’, ‘mw_z’].

Returns

The data from the FIREFLY summary file for the target galaxy

class marvin.contrib.vacs.firefly.FIREFLYVAC[source]

Bases: VACMixIn

Provides access to the MaNGA-FIREFLY VAC.

VAC name: FIREFLY

URL: https://www.sdss.org/dr17/manga/manga-data/manga-firefly-value-added-catalog/

Description: Returns integrated and resolved stellar population parameters fitted by FIREFLY

Authors: Justus Neumann, Jianhui Lian, Daniel Thomas, Claudia Maraston, and Lewis Hill

get_target(parent_object)[source]

Accesses VAC data for a specific target from a Marvin Tool object

prepare_container(plateifu, imagesz, n, release)[source]

Auxillary method for get_target(), used only for DR17. VAC access is transfered to this method to assure that vacfile is only downloaded when key is selected.

set_summary_file(release)[source]

Sets the path to the Firefly summary file

Visual Morphology

class marvin.contrib.vacs.visual_morph.VMORPHOVAC[source]

Bases: VACMixIn

Provides access to the MaNGA-VISUAL-MORPHOLOGY VAC.

VAC name: manga_visual_morpho

URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-visual-morphologies-from-sdss-and-desi-images

Description: A new morphology catalogue is presented in this VAC, based on a pure visual morphological classification. This catalogue contains the T-Type morphology, visual attributes (barred, edge-on, tidal debris) and the CAS parameters (Concentration, Asymmetry and Clumpiness; from the DESI images.

Authors: J. Antonio Vazquez-Mata and Hector Hernandez-Toledo

get_target(parent_object)[source]

Accesses VAC data for a specific target from a Marvin Tool object

set_summary_file(release)[source]

Sets the path to the Visual Morphology summary file

class marvin.contrib.vacs.visual_morph.VizMorphTarget(targetid, vacfile, sdss=None, desi=None, mos=None)[source]

Bases: VACTarget

A customized target class to also display morphology mosaics

This class handles data from both the Visual Morphology summary file and the individual image files. Row data from the summary file for the given target is returned via the data property. Images can be displayed via the the show_mosaic method.

Parameters
  • targetid (str) – The plateifu or mangaid designation

  • vacfile (str) – The path of the VAC summary file

  • sdss (str) – The path to the DR16 SDSS image mosaic

  • desi (str) – The path to the DR16 DESI image mosaic

  • mos (str) – The path to the DR17 combined image mosaic

Variables
  • data – The target row data from the main VAC file

  • targetid (str) – The target identifier

show_mosaic(survey=None)[source]

Show the mosaic image for the given survey in DR16 or the combined in DR17

Displays the mosaic image of visual morphology classification for the given survey as a Matplotlib Figure/Axis object.

Parameters

survey (str) – The survey name. Can be either “sdss” or “desi” for DR16; or “mos” for DR17

Returns

A matplotlib axis object

Galaxy Zoo 3D

class marvin.contrib.vacs.galaxyzoo3d.GZ3DTarget(filename, cube, maps)[source]

Bases: object

A customized class to open and display GZ3D spaxel masks

Parameters
Variables
  • hdulist (list) – List containing the 11 HDUs present in the GZ3D fits file (see <url> for full data model)

  • wcs (astropy.wcs) – WCS object for the GZ3D masks (e.g. HDU[1] to HDU[4])

  • image (numpy.array) – The galaxy image shown to GZ3D volunteers

  • center_mask (numpy.array) – Pixel mask (same shape as image) of the clustering results for the galaxy center(s). Each identified center is represented by a 2 sigma ellipse of clustered points with the value of the pixels inside the ellipse equal to the number of points belonging to that cluster.

  • star_mask (numpy.array) – Pixel mask (same shape as image) of the clustering results for forground star(s). Each identified star is represented by a 2 sigma ellipse of clustered points with the value of the pixels inside the ellipse equal to the number of points belonging to that cluster.

  • spiral_mask (numpy.array) – Pixel mask (same shape as image) of the spiral arm location(s). The value for the pixels is the number of overlapping polygons at that location.

  • bar_mask (numpy.array) – Pixel mask (same shape as image) of the bar location. The value for the pixels is the number of overlapping polygons at that location.

  • metadata (astropy.Table) – Table containing metadata about the galaxy.

  • ifu_size (int) – Size of IFU

  • center_clusters (astropy.Table) – Position for identified galaxy center(s) in both image pixels and (RA, DEC)

  • num_centers (int) – Number of galaxy centers identified

  • star_clusters (astropy.Table) – Position for identified forground star(s) in both image pixels and (RA, DEC)

  • num_stars (int) – Number of forground stars identified

  • center_star_classifications (astropy.Table) – Raw GZ3D classifications for center(s) and star(s)

  • num_center_star_classifications (int) – Total number of classifications made for either center(s) or star(s)

  • num_center_star_classifications_non_blank (int) – Total number of non-blank classifications made for either center(s) or star(s)

  • spiral_classifications (astropy.Table) – Raw GZ3D classifications for spiral arms

  • num_spiral_classifications (int) – Total number of spiral arm classifications made

  • num_spiral_classifications_non_blank (int) – Total number of non-blank spiral arm classifications made

  • bar_classifications (astropy.Table) – Raw GZ3D classifications for bars

  • num_bar_classifications (int) – Total number of bar classifications made

  • num_bar_classifications_non_blank (int) – Total number of non-blank bar classifications made

  • cube (marvin.tools.cube.Cube) – Marvin Cube object

  • maps (marvin.tools.maps.Maps) – Marvin Maps object

  • center_mask_spaxel (numpy.array) – The center_mask projected into spaxel space

  • star_mask_spaxel (numpy.array) – The star_mask projected into spaxel space

  • spiral_mask_spaxel (numpy.array) – The spiral_mask projected into spaxel space

  • bar_mask_spaxel (numpy.array) – The bar_mask projected into spaxel space

  • other_mask_spaxel (numpy.array) – A mask for spaxel not contained in any of the other spaxel masks

center_in_pix()[source]

Return the center of the IFU in image coordinates

get_center_ellipse_list()[source]

Return matplotlib ellipse objects for identified galaxy center(s)

get_distance()[source]

Find the radial distance between each spaxel and the center of the galaxy

get_hexagon(correct_hex=True, edgecolor='magenta')[source]

Get the IFU hexagon in image as a matplotlib polygon for plotting

Paramters:
correct_hex (bool, default=True):

If True it returns the correct IFU hexagon, if False it returns the hexagon shown to the GZ3D volunteers (this was slightly too small due to a bug when producing the original images for the project).

edgecolor (matplotlib color):

What color to make the hexagon.

Returns

hexagon (matplotlib.patches.RegularPolygon) – A matplotlib patch object of the IFU hexagon returned in image coordinates.

get_mean_spectra(inv=False)[source]

Calculate the mean spectra inside each of the spaxel masks accounting for covariance following Westfall et al. 2019’s method based in distance between spaxels.

Parameters

inv (bool, default=False) – If true this function will also calculate the mean spectra for each inverted mask. Useful if you want to make difference spectra (e.g. <spiral> - <not spiral>).

Variables
  • mean_bar (marvin.tools.quantities.spectrum) – average spectra inside the bar mask

  • mean_spiral (marvin.tools.quantities.spectrum) – average spectra inside the spiral mask

  • mean_center (marvin.tools.quantities.spectrum) – average spectra inside the center mask

  • mean_not_bar (marvin.tools.quantities.spectrum) – average spectra outside the bar mask

  • mean_not_spiral (marvin.tools.quantities.spectrum) – average spectra outside the spiral mask

  • mean_not_center (marvin.tools.quantities.spectrum) – average spectra outside the center mask

get_spaxel_grid(grid_size=None)[source]

Return the data needed to plot the spaxel grid over the GZ3D image

get_star_ellipse_list()[source]

Return matplotlib ellipse objects for identified forground star(s)

plot_bpt(ax=None, colors=['C1', 'C0', 'C4', 'C2'], bpt_kind='log_nii_ha', **kwargs)[source]

Plot a BPT diagram for a galaxy that colors the data points based on the GZ3D masks

Keywords:
ax (matplotlib.axes.Axes):

The matplotlib axis object to use for the plot. If None is provided a new figure and axis is created for the plot.

colors (list):

A list of matplotlib colors to use for each of the masks. The order of the list is: [Bar, Spiral, Forground Stars, Galaxy Center(s)]. Default value is ['C1', 'C0', 'C4', 'C2'].

bpt_kind (string):

The kind of BPT plot to make. This can be one of three values 'log_nii_ha' (default), 'log_sii_ha', or 'log_oi_ha'.

kwargs:

All other keywords are pass forward to matplotlib’s scatter plot function.

Returns

ax (matplotlib.axes.Axes) – The matplotlib axis object for the resulting plot.

plot_image(ax=None, color_grid=None, correct_hex=True, hex_color='C7')[source]

Plot original GZ3D image that was shown to volunteers.

Keywords:
ax (matplotlib.axes.Axes):

Matplotlib axis object. This axis must have a WCS projection set e.g. ax = fig.add_subplot(111, projection=data.wcs). If not provided a new figure and axis will be created with the correct projection.

color_grid (string):

A matplotlib color to use for the RA-DEC grid lines. Default None.

correct_hex (bool):

If set to true the correct MaNGA hexagon will be plotted on top of the galaxy cutout (the hexagon in the image shown to the volunteers was slightly too small due to a bug when producing the original images for the project).

hex_color (string):

A matplotlib color to use for the correct MaNGA hexagon if correct_hex is True. Default is 'C7'.

Returns

ax (matplotlib.axes.Axes) – The matplotlib axis object for the resulting plot.

plot_masks(colors=['C1', 'C0', 'C4', 'C2'], color_grid=None, hex=True, hex_color='C7', show_image=False, subplot_spec=None, spaxel_masks=False)[source]

Plot GZ3D masks

Keywords:
colors (list):

A list of matplotlib colors to use for each of the masks. The order of the list is: [Bar, Spiral, Forground Stars, Galaxy Center(s)]. Default value is ['C1', 'C0', 'C4', 'C2'].

color_grid (string):

A matplotlib color to use for the RA-DEC grid lines. Default None.

hex (bool):

If True plot the MaNGA hexagon. Default value is True.

hex_color (string):

A matplotlib color to use for the correct MaNGA hexagon if correct_hex is True. Default is 'C7'.

show_image (bool):

If True plot the original galaxy image behind the masks. Default is False.

subplot_spec (matplotlib.gridspec.SubplotSpec):

A gridspec subplot specification for this plot. If None is provided a new figure will be created.

spaxel_masks (bool):

If True use the masks projected on to the MaNGA spaxel grid, other wise plot them on the pixel grid of the GZ3D image shown to the volunteers. Default value is False.

polar_plot(x_unit='theta', ax=None, colors=['C1', 'C0', 'C4', 'C2'], key='specindex_dn4000', ylabel='D_{n}4000', snr=3, sf_only=False, **kwargs)[source]

Make a plot of a MaNGA Map value vs. R or theta with the points color coded by what GZ3D mask they belong to.

x_unit (string):

What x-value to plot against. Either 'theta' (default) or 'radius'.

ax (matplotlib.axes.Axes):

The matplotlib axis object to use for the plot. If None is provided a new figure and axis is created for the plot.

colors (list):

A list of matplotlib colors to use for each of the masks. The order of the list is: [Bar, Spiral, Forground Stars, Galaxy Center(s)]. Default value is ['C1', 'C0', 'C4', 'C2'].

key (string):

Name of the MaNGA Map attribute to plot. The default value is 'specindex_dn4000'.

ylabel (string):

The ylabel to use for the plot (units will automatically be added to the label based on the map being used).

snr (float):

The minimum signal to noise cutoff to use for the plot. The default value is 3.

sf_only (bool):

If True only plot spaxes that are star forming. The default value is False.

kwargs:

All other keywords are pass forward to matplotlib’s scatter plot function.

Returns

ax (matplotlib.axes.Axes) – The matplotlib axis object for the resulting plot.

class marvin.contrib.vacs.galaxyzoo3d.GZ3DVAC[source]

Bases: VACMixIn

Provides access to the Galaxy Zoo 3D spaxel masks.

VAC name: Galaxy Zoo: 3D

URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=galaxy-zoo-3d

Description: Galaxy Zoo: 3D (GZ: 3D) made use of a project on the Zooniverse platform to

crowdsource spaxel masks locating galaxy centers, foreground stars, bars and spirals in the SDSS images of MaNGA target galaxies. These masks (available for use within Marvin) can be used to pick out spectra, or map quantities associated with the different structures. See Masters et al. 2021 for more information, advice on useage and examples.

Authors: Coleman Krawczyk, Karen Masters and the rest of the Galaxy Zoo 3D Team.

get_target(parent_object)[source]

Find the GZ3D data based on the manga ID

set_summary_file(release)[source]

Sets the path to the GalaxyZoo3D summary file

marvin.contrib.vacs.galaxyzoo3d.alpha_maps(maps, colors=None, vmin=0, vmax=15, background_image=None)[source]

Take a list of color masks and base color values and make an alpha-mask overlay image.

Parameters

maps (list) – List of masks to use as alpha maps

Keywords:
colors (list):

What matplotlib color to use for each of the input maps (defaults to standard MPL color cycle)

vmin (int):

Value in the maps at or below this value will be 100% transparent

vmax (int):

Value in the maps at or above this value will be 100% opaque

background_image (numpy.array):

RGB array to use as the background image (default solid white)

Returns

overlay (numpy.array) – RGB array with each map overlayed on each other with alpha transparency.

marvin.contrib.vacs.galaxyzoo3d.alpha_overlay(C_a, a_a, C_b, a_b=None)[source]

Take a base color (C_a), an alpha map (a_a), background image (C_b), and optional background alpha map (a_b) and overlay them.

Paramters:
C_a (numpy.array):

1x3 RGB array for the base color to be overlayed

a_a (numpy.array):

NxM array of alpha values for each postion on an image

C_b (numpy.array):

1x3 RGB array for the background color or NxMx3 RGB array for a background image

a_b (numpy.array):

NxM array of alpha values for the background color/image

Returns

c_out (numpy.array) – NxMx3 RGB array containing the alpha overlayed image.

marvin.contrib.vacs.galaxyzoo3d.convert_json(table, column_name)[source]

Unpacks the JSON column of a table

Paramters:
table (astropy.table.Table):

An astropy table

column_name (str):

The name of the column made up of JSON strings

The input table is updated in place by appending _string to the end of the JSON column name and adding a new column with _list on the end with the list representation of the same column.

marvin.contrib.vacs.galaxyzoo3d.cov_to_ellipse(cov, pos, nstd=1, **kwargs)[source]

Create a covariance ellipse given an covariance matrix and postion

Paramters:
cov (numpy.array):

2x2 covariance matrix

pos (numpy.array):

1x2 center position of the ellipse

Keywords:
nstd (int):

Number of standard deviations to make the output ellipse (Default=1)

kwargs:

All other keywords are passed to matplotlib.patches.Ellipse

Returns

ellipse (matplotlib.patches.Ellipse) – matplotlib ellipse patch object

marvin.contrib.vacs.galaxyzoo3d.make_alpha_bar(color, vmin=-1, vmax=15)[source]

Make a matplotlib color bar for a alpha mask of a single color

Parameters

color (string) – A matplotlib color (any format matplotlib accepts)

Keywords:
vmin (int):

The minimum value for the colorbar. Default value is -1 to ensure the labels show up correctly when used with plot_alpha_bar.

vmax (int):

The maximum value for the colorbar. Default value is 15.

Returns

colormap (mpl.colors.ListedColormap) – The colormap for the colorbar norm (mpl.colors.Normalize):

The normalization for the color bar

marvin.contrib.vacs.galaxyzoo3d.make_alpha_color(count, color, vmin=1, vmax=15)[source]

Give a matplotlib color and alpha channel proportional to the input count value.

Parameters
  • count (int) – The count value used to select an alpha value

  • color (string) – A matplotlib color (any format matplotlib accepts)

Keywords:
vmin (int):

The count value to be associated with transparent. Default is 1.

vmax (int):

The count value to be associated with opaque. Default is 15.

Returns

alpha_color (tuple) – An rgba tuple for the new alpha color

marvin.contrib.vacs.galaxyzoo3d.non_blank(table, *column_name)[source]

Count how many non-blank classifications are in the given columns of the input table.

Paramters:
table (astropy.table.Table):

An astropy table with Zooniverse classifications

column_name(s) (str):

One or multiple column names

Returns

non_blank (int) – The total number of non-blank classifications across all input column names (combined with “logical or” in a single row).

marvin.contrib.vacs.galaxyzoo3d.plot_alpha_bar(color, grid, ticks=[])[source]

Display and alpha colorbar on a plot grid.

Parameters
  • color (string) – A matplotlib color (any format matplotlib accepts)

  • grid (matplotlib.gridspec.SubplotSpec) – A gridspec subplot specification to place the color bar in

Keywords:
ticks (list):

A list of tick value for the colorbar

Returns

ax_bar (matplotlib.axes.Axes) – Matplotlib axis object for the colorbar colorbar (mpl.colorbar.ColorbarBase):

Matplotlib colorbar object

marvin.contrib.vacs.galaxyzoo3d.plot_alpha_scatter(x, y, mask, color, ax, snr=None, sf_mask=None, value=True, **kwargs)[source]

Make a scatter plot where each x-y point has and alpha transparency set by the values in a count mask array.

Parmeters:
x (numpy.array):

1-D numpy array with x-values to be plotted

y (numpy.array or spectral line object from a Marvin Maps cube):

1-D numpy array with y-values to be plotted

mask (numpy.array):

1-D numpy array with mask array containing the “count” value for each (x,y) data point

color (string):

A matplotlib color (any format matplotlib accepts) used for the base color of the data points

ax (matplotlib.axes.Axes):

The maplotlib axes to use for the plot

Keywords:
snr (float):

Minimum signal to noise ratio to use as a cutoff for the y-values. Defaults to None. Only used if value=True

sf_mask (numpy.array):

1-D numpy array with A star formation region mask that is 1 when there is star formation in a spaxel and 0 otherwise. If passed in only spxels where this mask is 1 will be plotted.

value (bool):

If True y is a spectral line object from a Marvin Maps cube, otherwise y is assumed to be regular np.array object.

**kwargs:

All other keywords are passed forward to matplotlib’s scatter plot function.

Returns

scatter (matplotlib.collections.PathCollection) – A maplotlib scatter plot object