nanograv / enterprise

ENTERPRISE (Enhanced Numerical Toolbox Enabling a Robust PulsaR Inference SuitE) is a pulsar timing analysis code, aimed at noise analysis, gravitational-wave searches, and timing model analysis.
https://enterprise.readthedocs.io
MIT License
65 stars 67 forks source link

Parameter and Signal classes #9

Closed jellis18 closed 7 years ago

jellis18 commented 7 years ago

In terms of overall design I think that we should have a Parameter class similar to PINT Parameters with priors attached as they do there. We should then have a Signal class, again similar to PINT models which will have a setup method that reads in Pulsar class instances, or at least attributes. This way we can make a collection of signals independent of the pulsars. It is only when the signals are evaluated (or setup) that they interact with the pulsar.

In terms of the model, I think we should have a PulsarModel and a PTAModel where the pulsar model is for single pulsars (i.e., noise, timing model, etc.) and the PTA model is for common signals (i.e., GWs, ephemeris, clocks). We should probably focus on the PulsarModel first as a PTAModel would just be a collection of PulsarModel instances + some methods to compute PTA covariances and such.

For the PulsarModel class I think it should read in the Pulsar object and a collection of Signal objects similar to the PINT residual class. I haven't fully thought through how likelihoods would be incorporated into this. Of course they should be part of the PulsarModel but maybe that should be sub-classed for different kinds of likelihood (i.e., marginalized vs fully hierarchical).

For now I'm attaching a Milestone to have a basic working version of PulsarModel finished by the beginning of the busy week.

paulthebaker commented 7 years ago

The way PINT does it's parameter class is pretty cool.

As for the priors, I think we need to have a few primitive choices. We absolutely need a Gaussian prior with the mean and variance or standard deviation defining it and a uniform prior with a two parameter min/max. We might also want to include a log-Gaussian prior, a sum of Gaussians for multimodal distributions, and an empirical prior that's just the binned output of a previous run.

PINT defines a few special cases then relies on SciPy.stats to handle other cases. I think we can mimic what they do and add in our special cases.

jellis18 commented 7 years ago

OK, since starting this issue we have changed the way we are doing things. Originally we were aiming for a PINT-like multiple inheritance signal builder. We have since moved to a class factory structure that allows us to create signal classes on the fly through clever use of meta classes. I really like this structure and we are able to do the standard noise analysis already as seen in my notebook. However there are still several outstanding issues and design choices that we have to make:

I've been thinking about these things but don't have a good answer to any at the moment. I think until we can answer most of these questions we should just keep sandboxing in the dev branch.

Any ideas?

jellis18 commented 7 years ago

This has basically been solved in PRs #89 and #54. I'm closing the issue.