Results

Getting Started

When you perform a Query in Marvin, you get a Results object. This page describes the basic usage of Marvin Results. See the Results Reference for a full description of all the methods available.

To perform a simple Query

from marvin.tools.query import Query
q = Query(search_filter='nsa.z < 0.1', return_params=['absmag_g_r'])

and to get the Results, use the run method on your Query object. Once your query is run you can access the list of query results from the results attribute.

r = q.run()

# number of results
r.totalcount
2560

# view the results
r.results
<ResultSet(set=1/26, index=0:100, count_in_set=100, total=2560)>
[ResultRow(mangaid=u'1-109394', plate=8082, plateifu=u'8082-9102', ifu_name=u'9102', elpetro_absmag_g_r=1.26038932800293, z=0.0361073),
 ResultRow(mangaid=u'1-113208', plate=8618, plateifu=u'8618-3701', ifu_name=u'3701', elpetro_absmag_g_r=1.48788070678711, z=0.0699044),
 ResultRow(mangaid=u'1-113219', plate=7815, plateifu=u'7815-9102', ifu_name=u'9102', elpetro_absmag_g_r=0.543312072753906, z=0.0408897),
 ResultRow(mangaid=u'1-113375', plate=7815, plateifu=u'7815-9101', ifu_name=u'9101', elpetro_absmag_g_r=0.757579803466797, z=0.028215),
 ResultRow(mangaid=u'1-113379', plate=7815, plateifu=u'7815-6101', ifu_name=u'6101', elpetro_absmag_g_r=1.09770011901855, z=0.0171611),
 ResultRow(mangaid=u'1-113403', plate=7815, plateifu=u'7815-12703', ifu_name=u'12703', elpetro_absmag_g_r=0.745466232299805, z=0.0715126),
 ResultRow(mangaid=u'1-113418', plate=7815, plateifu=u'7815-12704', ifu_name=u'12704', elpetro_absmag_g_r=1.44098854064941, z=0.0430806),
 ...]

The returned object is a ResultSet, which is a fancy list of Python tuple objects containing the results of your query. The representation of the ResultSet indicates some metadata like the total result count, the current set (page) of the total, the current count in the current set, and the array indices out of the total set.

The Results object also contains the Query Datamodel which you can explore.

r.datamodel
<QueryDataModel release='MPL-4', n_groups=7, n_parameters=565, n_total=0>

Alternatively, you can perform it in a single step

from marvin.tools.query import doQuery
q, r = doQuery(search_filter='nsa.z < 0.1')

Reference/API

Class Inheritance Diagram

Inheritance diagram of marvin.tools.results

Class

marvin.tools.results.Results([results, …]) A class to handle results from queries on the MaNGA dataset
marvin.tools.results.ResultSet(_objects, …) A Set of Results

Methods

marvin.tools.results.Results.extendSet([…]) Extend the Result set with the next page
marvin.tools.results.Results.loop([chunk]) Loop over the full set of results
marvin.tools.results.Results.getNext([chunk]) Retrieve the next chunk of results
marvin.tools.results.Results.getPrevious([chunk]) Retrieve the previous chunk of results.
marvin.tools.results.Results.getSubset(start) Extracts a subset of results
marvin.tools.results.Results.getAll([force]) Retrieve all of the results of a query
marvin.tools.results.Results.plot(x_name, …) Make a scatter plot from two columns of results
marvin.tools.results.Results.hist(name, **kwargs) Make a histogram for a given column of the results
marvin.tools.results.Results.save([path, …]) Save the results as a pickle object
marvin.tools.results.Results.restore(path[, …]) Restore a pickled Results object