lsst.meas.algorithms  20.0.0-2-g92e20685+8
Public Member Functions | Static Public Attributes | List of all members
lsst.meas.algorithms.readTextCatalogTask.ReadTextCatalogTask Class Reference

Read an object catalog from a text file. More...

Inheritance diagram for lsst.meas.algorithms.readTextCatalogTask.ReadTextCatalogTask:

Public Member Functions

def run (self, filename)
 

Static Public Attributes

 ConfigClass = ReadTextCatalogConfig
 

Detailed Description

Read an object catalog from a text file.

Contents

Description

Read an object catalog from a text file. Designed to read foreign catalogs so they can be written out in a form suitable for IngestIndexedReferenceTask.

The file is assumed to be encoded as UTF-8 (which is compatible with ASCII).

Task initialisation

Configuration parameters

See ReadTextCatalogConfig

A complete example of using ReadTextCatalogTask

Given a file named table.csv containing the following:

ra,     dec,    flux
5.5,    -45.2,  12453
19.6,   34.2,   32123

you can read this file with the following code:

from lsst.meas.algorithms.readTextCatalogTask import ReadTextCatalogTask
task = ReadTextCatalogTask()
catalogArray = task.run("table.csv")

The resulting catalogArray is a numpy structured array containing three fields ("ra", "dec" and "flux") and two rows of data. For more complex cases, config parameters allow you to specify the names of the columns (instead of using automatic discovery) and set the number of rows to skip.

Definition at line 66 of file readTextCatalogTask.py.

Member Function Documentation

◆ run()

def lsst.meas.algorithms.readTextCatalogTask.ReadTextCatalogTask.run (   self,
  filename 
)
Read an object catalog from the specified text file

@param[in] filename  path to text file
@return a numpy structured array containing the specified columns

Definition at line 115 of file readTextCatalogTask.py.

Member Data Documentation

◆ ConfigClass

lsst.meas.algorithms.readTextCatalogTask.ReadTextCatalogTask.ConfigClass = ReadTextCatalogConfig
static

Definition at line 113 of file readTextCatalogTask.py.


The documentation for this class was generated from the following file: