Configuration Class (marvin.config)

The Marvin Config class controls the global configuration of Marvin. It has several attributes that control how you interact with MaNGA data.

  • mode:

    The mode you want to run Marvin in. Mode can be either ‘local’, ‘remote’, or ‘auto’. This determines how you interact with the MaNGA data. Either through local FITS files on your own filesystem, or remotely using an API, if you do not have the data stored locally. For more information, see Data Access Modes below.

  • download:

    Setting this attribute to True tells Marvin that whenever you don’t have a file locally, to use sdss_access to download it via rsync. See Downloading Objects below.

  • release:

    The Config class has a single attribute referencing the version of MaNGA data you are working with. release refers to either MaNGA Product Launches (MPLs), e.g. “MPL-5”, or Data Releases (DRs), e.g. “DR13”. See Setting Versions below, to see how to set the version of the data you want.

  • use_sentry:

    Marvin uses Sentry to handle real-time logging of errors. This setting toggles this feature. The default value is set to True. Set to False to disable.

  • add_github_message:

    Marvin appends a message to every error instructing you on how to submit a new Github Issue regarding the error you just experienced. If you wish to disable this message, set this value to False. The default value is True.

  • db:

    This attribute lets Marvin know if you have a database that it can be connected to. If you have no database, this attribute will be set to None. This attribute is set automatically and you do not have to do anything with this attribute.

  • sasurl:

    This attribute tells Marvin what the SAS base url is when accessing the Marvin API. This attribute is set automatically and you do not have to do anything with this attribute.

  • urlmap:

    This attribute is a lookup dictionary for all of the API routes that Marvin uses internally. This attribute is set automatically. If you not using the Marvin API Interaction class directly, then you do not have to do anything with this attribute.

  • access:

    This attribute informs Marvin of the type of access it has. The allowed values are either “public” or “collab”, for public and collaborationa access, respectively. Public access provides access only to MaNGA public Data Releases, while collaboration access provides access to all MaNGA data release, DRs and MPLs. The default value is public.

  • login:

    This method

Data Access Modes

  • Local mode - Use this mode to deal with local FITS files either in your local SAS or through explicit file locations.

  • Remote mode - Use this mode to deal with data remotely. The data is retrieved from Utah using the API. Depending on your use, it may be returned as a JSON object or used to complete the Tool function you are using.

  • Auto mode - Use this mode to have Marvin attempt to automatically handle the modes. Marvin starts in this mode. It is recommended to leave Marvin in this mode, and let him handle your data access.

  • See Data Access Modes for more detailed information.

Setting Versions

You can globally control the version of the data you want to access using several convienence methods in the Config class. Setting the release will also internally set up the appropriate DRP and DAP versions.

setRelease(): main method to set the release version (e.g. MPL-5 or DR13). Accepts either MPL or DR strings.

from marvin import config

You can also individually set MPLs or DRs separately with similar methods.

setMPL(): set the version using the MPL designation (e.g. MPL-4)

from marvin import config
config.setMPL('MPL-4') # sets the global version to MPL-4

setDR(): set the version using the DR designation (e.g. DR13)

from marvin import config
config.setDR('DR15') # sets the global version to DR15

Public vs Collab Access

There are two access modes in Marvin, one for the public, and one for members of the SDSS collaboration. The default access mode in Marvin is public. Public access only provides access to MaNGA released in public Data Releases (DRs).

# the default release with public access is the latest DR
from marvin import config
INFO: No release version set. Setting default to DR15

# the data release is DR15

If you are a member of the SDSS collaboration and have properly set up your netrc authentication, you can switch access to collab and get access to MaNGA collaboration data, MPLs, as well as DRs.

# switch to collaboration access
from marvin import config
config.access = 'collab'

# switch to an MPL

Logging In

The Marvin API requires authentication with a token for access. To receive a token, use the login method

# to receive an API token

# check you have a token

A valid token lasts for 300 days. When your token expires, you will need to login again to receive a new token.

# receive a fresh token

Note, by default your token will disappear upon exiting your iPython terminal session. You will need to login again within a new session. To preserve your token between iPython sessions, copy your token into the use_token attribute of your custom Marvin config file.

Attempting to use Marvin with invalid credentials or an invalid token will produce the following error.

# access a cube remotely without proper credentials
cube = Cube('8485-1901', mode='remote')

MarvinError: found a problem when checking if remote cube exists: API Authentication Error: Token has expired. Please check your token or login again for a fresh one.

Marvin Custom Configuration File

Most Marvin configuration options can be set using the Marvin config object within iPython. You can also set configuration parameters using a custom YAML configuration file, marvin.yml. This file must be placed in the following directory in your HOME, ~/.marvin/marvin.yml. Currently configurable options are:

  • check_access:

    Set to True to have Marvin automatically check for proper netrc collaboration access and switch to collab access mode on startup. Default is False.

  • use_sentry:

    Set to False to disable Sentry error logging in Marvin. Default is True.

  • add_github_message:

    Set to False to disable the Github Issue message on all Marvin Errors. Default is True.

  • use_token:

    Set this value to your valid API token. This ensures proper API authentication across iPython sessions.

  • default_release:

    Set to to the release you want to use by default when importing Marvin. If set to null, uses the latest available version for your access mode. Default is null.