radio-astro-tools / signal-id

Signal identification tools (masking and noise) for spectral line data.
6 stars 7 forks source link

Operations history? #10

Open low-sky opened 10 years ago

low-sky commented 10 years ago

Since a lot of the minor methods are order dependent, should the methods in this packaged track a history of operations, perhaps as an extended string array so that you could get something like:

>>> noise_object.history()
Noise created from cube with shape (70,500,500).
Initial uniform scale of noise: 0.0024 Jy/beam
Signal masked out with SNR threshold of 3 with 1 iterations
Spatial and spectral norms estimated using MAD method with 1 iterations
Signal masked out with SNR threshold of 5 with 3 iterations
Spatial and spectral norms estimated using MAD method with 3 iterations

This seems more important for masking history.

akleroy commented 10 years ago

We could definitely do this and it seems reasonable.

There are logger modules or we could write our own very simple one.

I guess as a first step, maybe we just start by having each routine optionally output a report.

keflavich commented 10 years ago

It would be nice if the history generated a reproducible report, e.g. instead of Erik's proposal, something like:

>>> noise_object.history()
noise = NoiseCube(...) # Noise created from cube with shape (70,500,500).
mask = noise.signal_to_noise(3, iter=1) # Signal masked out with SNR threshold of 3 with 1 iterations

...obviously my example uses nonsense code, but the idea being to output code one could reuse rather than a pure description.

In terms of the infrastructure, for now it may be best to just pass this in the meta property. It looks like noise doesn't have that yet, but spectral cube does. Then noise.meta['history'] = 'history line 1\nhistory line 2' or something along those lines.