dragozzine / multimoon

fit solar system small body multiple systems with non-Keplerian orbits including quadrupole shapes
MIT License
4 stars 0 forks source link

Priors file read in every likelihood evaluation #21

Open benp175 opened 3 months ago

benp175 commented 3 months ago

https://github.com/dragozzine/multimoon/blob/b4a5f2605688beca04bb80f20f797748684b9a87/src/mm_likelihood.py#L108

On this line, the priors are read in every likelihood evaluation. This is bad for two reasons:

  1. If a user changes the priors file during a run, the edited priors will be used in further likelihood evaluations, with no record of it being stored in the results directory.
  2. It's just slow... There's no need to do millions of file read operations when you can use a tiny portion of memory.

To fix this, we should make it so that the priors are read in once and passed around to the necessary functions, like all other data. This may take some work to edit all the relevant files, so a temporary fix could be to read the priors file in the results directory. That version shouldn't be touched and fixes the first problem.

While this is being fixed, the priors should also be changed to be comma separated (rather than tab), for readability and consistency with other files.

I'm assigning myself to this and will fix soon. Just wanted to make this visible to the rest of the MultiMoon collaboration.

benp175 commented 3 months ago

This is where the reference to the results directory priors is assigned. Small change here should fix the first problem.

https://github.com/dragozzine/multimoon/blob/b4a5f2605688beca04bb80f20f797748684b9a87/src/mm_runprops.py#L117-L123