Project

General

Profile

Feature #1731

python API interface to legacy PolynomailMap class

Added by Rogers, Chris about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Python API
Target version:
Start date:
14 August 2015
Due date:
% Done:

100%

Estimated time:
Workflow:
New Issue

Description

As part of the alignment analysis, it would be useful to provide an interface to the legacy PolynomialMap class.

#1

Updated by Rogers, Chris about 6 years ago

Would like to make an interface to the following functions:

  • initialisation
  • Matrix<double> GetCoefficientsAsMatrix() const: return a list of lists instead of matrix
  • SetCoefficients(int point_dim): use a list of lists
  • void F(const double * point, double * value) const; should take a list as argument (point) and return a list (value)
  • int PointDimension() const
  • int ValueDimension() const
  • std::ostream& operator<<(std::ostream&, const PolynomialMap&): should be used to make a str function
  • static PolynomialMap* PolynomialLeastSquaresFit(
        const std::vector< std::vector<double> >& points,
        const std::vector< std::vector<double> >& values,
        unsigned int polynomialOrder,
        const std::vector<double>& weights = std::vector<double>());
    

    vectors should be lists or lists of lists
#2

Updated by Rogers, Chris about 6 years ago

Nb the class is not in legacy, it is in src/common_cpp/Maths

#3

Updated by Rogers, Chris about 6 years ago

So I have a pretty good first pass at bzr+ssh://bazaar.launchpad.net/~chris-rogers/maus/1731/

I have implemented and tested

  • init
  • get_coefficients_as_matrix
  • evaluate (was F)
  • least_squares_fit

I found that SetCoefficients throws an exception; I might have a look at that later on. But basically this is done and working.

#4

Updated by Rogers, Chris about 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Closed at r914

I could at some stage add point_dimension, value_dimension str() interfaces; these can be got at by doing

len(p_map.get_coefficients_as_matrix()) # value_dimension
len(p_map.get_coefficients_as_matrix()[0]) # point_dimension
str(p_map.get_coefficients_as_matrix()) # string representation

so it would be more a convenience than anything else... and hence low priority

Also available in: Atom PDF