Skip to content

Commit

Permalink
Clean up docs and respond to reviewer.
Browse files Browse the repository at this point in the history
  • Loading branch information
morriscb committed Apr 9, 2018
1 parent 7250210 commit df7e40d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 80 deletions.
34 changes: 21 additions & 13 deletions python/lsst/ap/association/assoc_db_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def make_table_from_afw_schema(self, table_name):
table_name : `str`
Name of the new table to create
Return
------
Returns
-------
sql_query : `str`
A string of the query command to create the new table in sqlite.
"""
Expand All @@ -110,9 +110,10 @@ def source_record_from_db_row(self, db_row):
db_row : `list` of ``values``
Retrieved values from the database to convert into a SourceRecord.
Return
------
Returns
-------
record : `lsst.afw.table.SourceRecord`
Converted source record.
"""

output_source_record = afwTable.SourceTable.makeRecord(
Expand All @@ -135,9 +136,10 @@ def source_record_to_value_list(self, source_record):
source_record : `lsst.afw.table.SourceRecord`
SourceRecord to convert.
Return
------
Returns
-------
source_list : `list` of ``values``
Extracted values from ``source_record`` in `list` form.
"""
values = []
for sub_schema in self._schema:
Expand Down Expand Up @@ -265,6 +267,8 @@ def load(self, expMd):
Returns
-------
dia_objects : `lsst.ap.association.DIAObjectCollection`
Collection of DIAObjects that are contained with the the bounding
box defined by expMd.
"""
ctr_coord = expMd.wcs.pixelToSky(expMd.bbox.getCenter())
max_radius = max(
Expand Down Expand Up @@ -328,7 +332,7 @@ def store_updated(self, dia_collection,
dia_collection : `lsst.ap.association.DIAObjectCollection`
A collection of DIAObjects that contains newly created or updated
DIAObjects. Only the new or updated DIAObjects are stored.
updated_dia_collection_indices : `ndarray` of `int`s
updated_dia_collection_indices : array-like of `int`s
Ids of DIAObjects within the set DIAObjectCollection that should
be stored as updated DIAObjects in the database.
"""
Expand Down Expand Up @@ -360,9 +364,9 @@ def _get_dia_objects(self, indexer_indices, expMd=None):
Parameters
----------
indexer_indices : `ndarray` of `int`s
indexer_indices : array-like of `int`s
Pixelized indexer indices from which to load.
expMd : `lsst.pipe.base.Struct`
expMd : `lsst.pipe.base.Struct` (optional)
Results struct with commponents:
- ``bbox``: Bounding box of exposure (`lsst.afw.geom.Box2D`).
Expand All @@ -371,6 +375,8 @@ def _get_dia_objects(self, indexer_indices, expMd=None):
Returns
-------
dia_objects : `list` of `lsst.ap.association.DIAObjects`
List of DIAObjects with the specified indexer index and contained
within the expMd bounding box.
"""
output_dia_objects = []

Expand All @@ -395,8 +401,8 @@ def _query_dia_objects(self, indexer_indices):
Spatial indices in the indexer specifying the area on the sky
to load DIAObjects for.
Return
------
Returns
-------
dia_objects : `list` of `tuples`
Query result containing the values representing DIAObjects
"""
Expand Down Expand Up @@ -435,9 +441,11 @@ def _check_dia_object_position(self, dia_object_record, expMd):
- ``bbox``: Bounding box of exposure (`lsst.afw.geom.Box2D`).
- ``wcs``: WCS of exposure (`lsst.afw.geom.SkyWcs`).
Return
------
Returns
-------
is_contained : `bool`
The location of defined in dia_object_record is contained within
the bounding box of expMd.
"""
if expMd is None:
return True
Expand Down
10 changes: 6 additions & 4 deletions python/lsst/ap/association/dia_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ def get_dia_object(self, id):
id : `int`
id of the DIAObject to retrieve
Return
------
Returns
-------
dia_object : `lsst.ap.association.DIAObject`
DIAObject with the ``id`` specified
"""
return self.dia_objects[self._id_to_index[id]]

Expand All @@ -84,9 +85,10 @@ def get_dia_object_ids(self):
id : `int`
id of the DIAObject to retrieve
Return
------
Returns
-------
dia_object_ids : `list` of `int`s
List of the ``ids`` of all DIAObjects contained in this collection.
"""
return list(self._id_to_index.keys())

Expand Down
62 changes: 10 additions & 52 deletions python/lsst/ap/association/dia_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@
def make_minimal_dia_object_schema():
"""Define and create the minimal schema required for a DIAObject.
Return
------
<<<<<<< HEAD
Returns
-------
dia_object_schema : `lsst.afw.table.Schema`
=======
`lsst.afw.table.Schema`
>>>>>>> c8d554a... Clean numpydocs.
Schema of DIAObjects
"""

schema = afwTable.SourceTable.makeMinimalSchema()
Expand All @@ -63,13 +60,10 @@ def make_minimal_dia_object_schema():
def make_minimal_dia_source_schema():
"""Define and create the minimal schema required for a DIASource.
Return
------
<<<<<<< HEAD
Returns
-------
dia_source_schema : `lsst.afw.table.Schema`
=======
`lsst.afw.table.Schema`
>>>>>>> c8d554a... Clean numpydocs.
Schema of DIASources
"""

schema = afwTable.SourceTable.makeMinimalSchema()
Expand All @@ -86,7 +80,6 @@ class DIAObject(object):
input object_source_record should contain summary statistics on the
SourceCatalog of DIASources. Using this optional input escapes the
need to recompute the summary statistics when not necessary.
<<<<<<< HEAD
Parameters
----------
Expand All @@ -95,18 +88,6 @@ class DIAObject(object):
object_source_record : `lsst.afw.table.SourceRecord` (optional)
Optional input SourceRecord containing summary statistics on
the input SourceCatalog.
=======
Parameters
----------
dia_source_catalog : `lsst.afw.table.SourceCatalog`
SourceCatalog of DIASources associated to this DIAObject
object_source_record : `lsst.afw.table.SourceRecord` (optional)
Optional input SourceRecord containing summary statistics on
the input SourceCatalog.
>>>>>>> c8d554a... Clean numpydocs.
"""
def __init__(self, dia_source_catalog, object_source_record=None):

Expand Down Expand Up @@ -135,13 +116,10 @@ def get(self, name):
name : `str` or `lsst.afw.table.Key`
Name of the column to retrieve the value from.
Return
------
<<<<<<< HEAD
Returns
-------
value : ``record value``
=======
``record value``
>>>>>>> c8d554a... Clean numpydocs.
Column value stored in this DIAObject.
"""

# This will in the future be replaced with a overwriting of __getattr
Expand Down Expand Up @@ -238,7 +216,7 @@ def get_light_curve(self):
Returns
-------
light_curve : `ndarry` of `float`s
An array like object specifying the light curve for this object.
An array-like object specifying the light curve for this object.
"""

# Loop through DIASources and return the "light curve"
Expand All @@ -255,10 +233,6 @@ def is_updated(self):
If True is returned this DIAObject has computed all of its summary
statistics for the current collection of DIASources that make it up.
Return
------
is_updated : `bool`
"""

return self._updated
Expand All @@ -267,43 +241,27 @@ def is_updated(self):
def dia_object_record(self):
"""Retrieve the SourceRecord that represents the summary statistics on
this DIAObject's set of DIASources.
Return
------
dia_object_record : `lsst.afw.table.SourceRecord`
"""
return self._dia_object_record

@property
def dia_source_catalog(self):
"""Retrieve the SourceCatalog that represents the DIASources that make
up this DIAObject.
Return
------
dia_source_catalog : `lsst.afw.table.SourceCatalog`
"""
return self._dia_source_catalog

@property
def dia_source_schema(self):
"""Retrieve the SourceCatalog that represents the DIASources that make
up this DIAObject.
Return
------
dia_source_schema : `lsst.afw.table.SourceCatalog`
"""
return self._dia_source_schema

@property
def n_dia_sources(self):
"""Return the number of DIASources currently associated with this
object.
Return
------
n_dia_sources : `int`
"""
return len(self._dia_source_catalog)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_association_db_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ def _store_and_retrieve_source_record(self,
converter : lsst.ap.association.SqliteDBConverter
converter defining the table and schema to store.
Return
------
lsst.afw.table.SourceRecord
Returns
-------
`lsst.afw.table.SourceRecord`
"""
self.assoc_db._store_record(
source_record, converter)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_association_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create_test_dia_objects(n_objects=1,
Returns
-------
A list of DIAObjects
`list` of `lsst.ap.association.DIAObjects`
"""
output_dia_objects = []
for obj_idx in range(n_objects):
Expand Down Expand Up @@ -98,7 +98,7 @@ def create_test_dia_sources(n_sources=5,
Returns
-------
A lsst.afw.SourceCatalog
`lsst.afw.table.SourceCatalog`
"""
sources = afwTable.SourceCatalog(make_minimal_dia_source_schema())

Expand Down Expand Up @@ -219,13 +219,13 @@ def _run_association_and_retrieve_objects(self, create_objects=False):
Parameters
----------
create_objects : bool
create_objects : `bool`
Boolean specifying if seed DIAObjects and DIASources should be
inserted into the database before association.
Return
------
dia_collection : lsst.ap.association.DIAObjectCollection
Returns
-------
dia_collection : `lsst.ap.association.DIAObjectCollection`
Final set of DIAObjects to be tested.
"""
if create_objects:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dia_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_test_dia_objects(n_objects=5, n_sources=5, start_id=0,
Returns
-------
A list of DIAObjects
`list` of `lsst.ap.association.DIAObjects`
"""
output_dia_objects = []
for obj_idx in range(n_objects):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dia_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def create_test_dia_sources(n_sources=5, schema=None):
Returns
-------
A lsst.afw.SourceCatalog
`lsst.afw.SourceCatalog`
"""
if schema is None:
schema = make_minimal_dia_source_schema()
Expand Down

0 comments on commit df7e40d

Please sign in to comment.