This is kind of a structural issue. At present, both dust and knu are pointer attributes of the mol field of grid point values. They are used both in making continuum and line images, and are also accessed when solving for the populations. In 'line' use they supply the relevant values at the frequency of each line being solved, but for continuum images they only have 1 value each, that of some representative frequency for the image.
The problem arises if one wants to supply precalculated population values. Both continuumSetup() and levelPops() free then re-malloc the mol pointer so as to get the correct size for dust/knu, which of course trashes any preloaded values of mol.pops. If dust/knu were in a separate structure, the above functions could resize this without affecting the pops values.
I'll put in a PR with a fix for this. It is preventing me implementing #92 fully.
This is kind of a structural issue. At present, both dust and knu are pointer attributes of the mol field of grid point values. They are used both in making continuum and line images, and are also accessed when solving for the populations. In 'line' use they supply the relevant values at the frequency of each line being solved, but for continuum images they only have 1 value each, that of some representative frequency for the image.
The problem arises if one wants to supply precalculated population values. Both
continuumSetup()andlevelPops()free then re-malloc themolpointer so as to get the correct size for dust/knu, which of course trashes any preloaded values ofmol.pops. If dust/knu were in a separate structure, the above functions could resize this without affecting the pops values.I'll put in a PR with a fix for this. It is preventing me implementing #92 fully.