Closed aewallwi closed 1 year ago
Patch coverage: 97.34
% and project coverage change: -0.04
:warning:
Comparison is base (
c34b82e
) 95.98% compared to head (fef5dd8
) 95.95%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Thanks for the comments @philbull. I think I've addressed everything so this is ready for another look (pending the tests running) :)
Hi @philbull . I believe @JianrongTan will be taking over this PR. Hopefully we can get it out soon.
Hi @philbull and @aewallwi! I have made some minor changes:
I think the PR now is fine to be merged into the main channel.
This PR addresses a current limitation in UVPspec class in that it addresses unique data samples with baseline pair and the average time of the two samples being crossed for a power spectrum sample. A common use case that comes up is when we cross two different times for the same baseline pair. For a concrete example, consider the baseline pair
(bl_0, bl_1)
where each baseline is sampled at two close-together timest1, t2
. It is common practice to form interleaves between the times so that we form the baseline-time pairs,(bl_0, t1) x conj((bl_1, t2))
and(bl_0, t2) x conj((bl_1, t1))
Both of these power spectra have the same average-time (t1/2 + t2/2
) and as a result, they cannot actually be stored in the sameUVPSpec
object. Currentlypspec_run
is forced to compute these interleaves from separate files and store them as differentUVPSpec
objects in aPSPecContainer
. Unfortunately, none of the data-averaging tools inhera_pspec
that rigorously track error statistics, etc, can operate on multipleUVPSpec
objects.I saw two potential solutions to this problem.
(1) Change the definition of
UVPSpec
to allow for time-permuted blt-pairs to be stored in the same object. (2) Change the averaging functions to operate on multiple UVPSpec objects.This PR addresses the problem through the first option. I decided to take the first approach because
1) Option(1) will result in a simpler interfaces than option (2). interleaving in time is done routinely in power spectrum estimation and I think that supporting it at the level of the
UVPSPec
class will simplify our interfaces for this common task by allowing us to calculate arbitrary time-interleaves on arbitrary numbers of input data files, avoiding additional up-stream pipeline tailoring. This PR does not add such functionality to thepspecdata.pspec_run
routines changing theUVPSPec
definition is necessary to support this.2) Option (1) requires less additional code then option (2). My initial hunch is that option 2 would result in more additional code since it would mean writing entire new versions of all of our averaging functions to operate over multiple objects (rather then axes in the data arrays of one of these objects). Option 1 (chosen here) focuses more on making point changes to existing code which in most cases involve swapping variable names.
Nblpairts
toNbltpairs
.Ntpairs
to represent the total number of unique time_1, time_2 pairs.Ntimes
in UVPspec objects to reference the total number of unique times intime_1_array
uniontime_2_array
. Before, it only referenced the total number of unique times inlst_average_array
.With these changes, we can apply all of the averaging infrastructure and error bar propagation that exists for individual UVPspec objects to arbitrary time interleaves.
This PR also manages backwards compatibility with
UVPSPec
files created with previous versions ofUVPSpec
by detecting the deprecatedNblpairts
variable when reading files and computing the new required variables, even if they are not present in these files from outdated versions.