Serial Data I/O¶
For each type of object, HARP provides several derived classes which support specific data “formats”. Some of these classes actually generate data on demand, or simulate the data at construction and cache it internally. There are two ways in which these classes should be instantiated, depending on your use case:
- If you are writing general tools that can work with any format for a particular type, use the factory method for that type. Always wrap the returned raw pointer in a shared_ptr (see examples) to ensure proper destruction of the object.
- If you are instantiating a particular format of an object (for example so that you can create it and write data out), then just declare the variable.
The first of the two use cases above allows us to implement inversion of control. In other words, it allows us to write general analysis tools that work with any kind of data that provides the correct interface.
Spectra¶
A collection of spectra are handled in HARP by the “spec” class. This represents one or more spectra with a common wavelength solution. This class also specifies which spectra represent “sky” signal.
- class harp::spec
- Public Functions
- spec()
- spec(std::string const & type, boost::property_tree::ptree const & props)
- virtual ~spec()
- virtual size_t n_spec() const
- virtual size_t n_lambda() const
- virtual void values(vector_double & data) const
- virtual void inv_variance(vector_double & data) const
- virtual void lambda(vector_double & lambda_vals) const
- void values(matrix_double & data) const
- void inv_variance(matrix_double & data) const
- std::string type() const
-
template <class T>boost::shared_ptr< T > shared_ref()
-
template <class T>boost::weak_ptr< T > weak_ref()
- Friends
- friend class boost::serialization::access
Images¶
- class harp::image
- Public Functions
- image()
- image(std::string const & type, boost::property_tree::ptree const & props)
- virtual ~image()
- virtual size_t n_rows() const
- virtual size_t n_cols() const
- virtual void values(vector_double & data) const
- virtual void inv_variance(vector_double & invvar) const
- void values(matrix_double & data) const
- void inv_variance(matrix_double & invvar) const
- std::string type() const
-
template <class T>boost::shared_ptr< T > shared_ref()
-
template <class T>boost::weak_ptr< T > weak_ref()
- Friends
- friend class boost::serialization::access
Point Spread Functions¶
The HARP “psf” class represents the point spread function of the instrument and describes the projection of flux from individual wavelength points of each spectrum onto an image.
- class harp::psf
- Public Functions
- psf()
- psf(std::string const & type, boost::property_tree::ptree const & props)
- virtual ~psf()
- virtual size_t n_spec() const
- virtual size_t n_lambda() const
- virtual size_t img_rows() const
- virtual size_t img_cols() const
- virtual vector_double lambda() const
- virtual void extent(size_t spec, size_t lambda, size_t & x_offset, size_t & y_offset, size_t & n_x, size_t & n_y) const
- virtual void response(size_t spec, size_t lambda, size_t & x_offset, size_t & y_offset, matrix_double & patch) const
- virtual size_t response_nnz_estimate() const
- virtual void extent_multi(std::map< size_t, std::set< size_t > > const & speclambda, std::vector< size_t > & x_offset, std::vector< size_t > & y_offset, std::vector< size_t > & n_x, std::vector< size_t > & n_y) const
- virtual void project(std::map< size_t, std::set< size_t > > const & speclambda, matrix_double & A) const
- virtual void project_transpose(std::map< size_t, std::set< size_t > > const & speclambda, matrix_double_sparse & AT) const
- void project(matrix_double & A) const
- void project_transpose(matrix_double_sparse & AT) const
- std::string type() const
-
template <class T>boost::shared_ptr< T > shared_ref()
-
template <class T>boost::weak_ptr< T > weak_ref()
- Public Static Functions
- size_t total_bins(std::map< size_t, std::set< size_t > > const & speclambda)
- Friends
- friend class boost::serialization::access
Targets¶
The HARP “targets” class represents a collection of objects.
- class harp::targets
- Public Functions
- targets()
- targets(std::string const & type, boost::property_tree::ptree const & props)
- virtual ~targets()
- virtual size_t n_objects() const
- virtual std::vector< object_p > objects() const
- std::string type() const
-
template <class T>boost::shared_ptr< T > shared_ref()
-
template <class T>boost::weak_ptr< T > weak_ref()
- Friends
- friend class boost::serialization::access