DAP Zonal Queries (or Spaxel Queries)

Marvin allows you to perform queries on individual spaxels within and across the MaNGA dataset.


In [20]:
from marvin import config
from marvin.tools.query import Query
config.mode='remote'

Let's grab all spaxels with an Ha-flux > 25 from MPL-5.


In [2]:
config.setRelease('MPL-5')
f = 'emline_gflux_ha_6564 > 25'
q = Query(searchfilter=f)
print(q)


WARNING: class ArrayOps not Formable
WARNING: class Character not Formable
WARNING: class Plate not Formable
Your parsed filter is: 
emline_gflux_ha_6564>25
Marvin Query(mode='remote', limit=100, sort=None, order='asc')

In [5]:
# let's run the query
r = q.run()


Results contain of a total of 18, only returning the first 18 results

In [6]:
r.totalcount
r.results


Out[6]:
[NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=26.3961, x=16, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=28.3759, x=16, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=25.651, x=16, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=30.3718, x=17, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=31.4754, x=17, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=28.3923, x=17, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=27.7081, x=18, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=28.2909, x=18, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=25.4768, x=18, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=26.4124, x=16, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=28.3806, x=16, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=25.6566, x=16, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=30.4327, x=17, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=31.4792, x=17, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=28.3875, x=17, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=27.7607, x=18, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=28.3337, x=18, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_gflux_ha_6564=25.4602, x=18, y=18)]

Spaxel queries are queries on individual spaxels, and thus will always return a spaxel x and y satisfying your input condition. There is the potential of returning a large number of results that span only a few actual galaxies. Let's see how many..


In [7]:
# get a list of the plate-ifus
plateifu = r.getListOf('plateifu')
# look at the unique values with Python set
print('unique galaxies', set(plateifu), len(set(plateifu)))


('unique galaxies', set([u'8485-1901']), 1)

Optimize your query

Unless specified, spaxel queries will query across all bintypes and stellar templates. If you only want to search over a certain binning mode, this must be specified. If your query is taking too long, or returning too many results, consider filtering on a specific bintype and template.


In [8]:
f = 'emline_gflux_ha_6564 > 25 and bintype.name == SPX'
q = Query(searchfilter=f, returnparams=['template.name'])
print(q)

# run it
r = q.run()


Your parsed filter is: 
and_(emline_gflux_ha_6564>25, bintype.name==SPX)
Marvin Query(mode='remote', limit=100, sort=None, order='asc')
Results contain of a total of 9, only returning the first 9 results

In [9]:
r.results


Out[9]:
[NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=26.3961, x=16, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=28.3759, x=16, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=25.651, x=16, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=30.3718, x=17, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=31.4754, x=17, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=28.3923, x=17, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=27.7081, x=18, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=28.2909, x=18, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', ifu_name=u'1901', template_name=u'GAU-MILESHC', bintype_name=u'SPX', emline_gflux_ha_6564=25.4768, x=18, y=18)]

Global+Local Queries

To combine global and local searches, simply combine them together in one filter condition. Let's look for all spaxels that have an H-alpha EW > 3 in galaxies with NSA redshift < 0.1 and a log sersic_mass > 9.5


In [10]:
f = 'nsa.sersic_logmass > 9.5 and nsa.z < 0.1 and emline_sew_ha_6564 > 3'
q = Query(searchfilter=f)
print(q)


Your parsed filter is: 
and_(nsa.sersic_logmass>9.5, nsa.z<0.1, emline_sew_ha_6564>3)
Marvin Query(mode='remote', limit=100, sort=None, order='asc')

In [11]:
r = q.run()


Results contain of a total of 1207, only returning the first 100 results

In [12]:
# Let's see how many spaxels we returned from how many galaxies
plateifu = r.getListOf('plateifu')
print('spaxels returned', r.totalcount)
print('from galaxies', len(set(plateifu)))


('spaxels returned', 1207)
('from galaxies', 1)

In [13]:
r.results[0:5]


Out[13]:
[NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_sew_ha_6564=24.1401832278, sersic_logmass=9.62934996005489, z=0.0407446920871735, x=6, y=15),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_sew_ha_6564=24.1401832278, sersic_logmass=9.62934996005489, z=0.0407446920871735, x=6, y=16),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_sew_ha_6564=24.1401832278, sersic_logmass=9.62934996005489, z=0.0407446920871735, x=6, y=17),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_sew_ha_6564=24.1401832278, sersic_logmass=9.62934996005489, z=0.0407446920871735, x=6, y=18),
 NamedTuple(mangaid=u'1-209232', plate=8485, plateifu=u'8485-1901', name=u'1901', emline_sew_ha_6564=24.1401832278, sersic_logmass=9.62934996005489, z=0.0407446920871735, x=6, y=19)]

Query Functions

Marvin also contains more advanced queries in the form of predefined functions. For example, let's say you want to ask Marvin

"Give me all galaxies that have an H-alpha flux > 25 in more than 20% of their good spaxels"

you can do so using the query function npergood. npergood accepts as input a standard filter expression condition. E.g., the syntax for the above query would be input as

npergood(emline_gflux_ha_6564 > 25) >= 20

The syntax is

FUNCTION(Conditional Expression) Operator Value

Let's try it...


In [17]:
config.mode='remote'
config.setRelease('MPL-4')
f = 'npergood(emline_gflux_ha_6564 > 5) >= 20'
q = Query(searchfilter=f)
r = q.run()


Your parsed filter is: 
npergood(emline_gflux_ha_6564>5)>=20
Results contain of a total of 8, only returning the first 8 results

In [18]:
r.results


Out[18]:
[NamedTuple(mangaid=u'1-114303', plate=7975, plateifu=u'7975-1901', name=u'1901'),
 NamedTuple(mangaid=u'1-277339', plate=8254, plateifu=u'8254-1901', name=u'1901'),
 NamedTuple(mangaid=u'1-209729', plate=8549, plateifu=u'8549-1901', name=u'1901'),
 NamedTuple(mangaid=u'1-137890', plate=8249, plateifu=u'8249-1901', name=u'1901'),
 NamedTuple(mangaid=u'1-24092', plate=7991, plateifu=u'7991-1901', name=u'1901'),
 NamedTuple(mangaid=u'12-84620', plate=7443, plateifu=u'7443-1901', name=u'1901'),
 NamedTuple(mangaid=u'1-22438', plate=7992, plateifu=u'7992-1901', name=u'1901'),
 NamedTuple(mangaid=u'1-277213', plate=8258, plateifu=u'8258-1901', name=u'1901')]

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: