igmhub / baofit

Fits cosmological data to measure baryon acoustic oscillations.
9 stars 5 forks source link

output MR #8

Closed slosar closed 11 years ago

slosar commented 12 years ago

Another fairly trivial fix whereby I also save output in a machinereadable format so that I don't have to write script after scipt that parses log files. Really used for example when fitting e.g. correlation function.

dkirkby commented 11 years ago

This functionality is now handled by the latest updates to likely and baofit, using two new FunctionMinimum methods that parallel the existing saveData and saveInverseCovariance for BinnedData:

    // Saves our parameter values and diagonal errors in plain text to the specified stream,
    // using full double precision. The format is a list of "index value error" lines, where
    // index values start at zero and include floating and fixed parameters, and error = 0
    // for fixed parameters.
    void saveParameters(std::ostream &os, bool onlyFloating = false) const;
    // Saves our floating-parameter covariance matrix in plain text to the specified stream,
    // use full double precision. The format is a list of "index1 index2 value" lines,
    // where value is the scaled covariance matrix element for (index1,index2), with indexing
    // that matches saveParameterValues(). Lines with value==0 or index2 < index1 are not
    // written to the file. Throws a RuntimeError if the covariance is not positive-definite.
    void saveFloatingParameterCovariance(std::ostream &os, double scale = 1) const;

baofit now always dumps two files using these two methods for the initial fit:

  outputPrefix + "save.pars"
  outputPrefix + "save.pcov"