Conversation
|
This PR goes along with the one in driftscan. Asking also @tristpinsm and @sjforeman additionally to @jrs65 for review. Thanks! |
sjforeman
left a comment
There was a problem hiding this comment.
Looks good to me! Perhaps @jrs65 or @tristpinsm should also take a look before the final approval.
draco/analysis/powerspectrum.py
Outdated
| return ps | ||
|
|
||
|
|
||
| class QuadraticPSEstimationXLarge(QuadraticPSEstimation): |
There was a problem hiding this comment.
Why does this need to be a separate class at all? Is there any reason this can't just replace the existing implementation? Or if not, merge them and change the behaviour to a config option, or even better, something that gets automatically determined based on the input data size.
There was a problem hiding this comment.
I mean, I could put them into one class and add a config option, but the two classes are fundamentally very different for the following reasons:
- the
QuadraticPSEstimationLargeuses fromdriftscanthePSMontelCarloLargeclass in which the clarray and the qestimator are MPIarrays parallelized over power spectrum bands. This is very different from the original code, in which clarray is gathered on all ranks and qestimators are calculated locally. - This class respects the fact that clarray and qestimator are parallelized over bands, therefore the sky data need to be pre-computed for all m first, as each rank needs all m's. This is also very different from the original code, where the sky data were handled parallel in m.
If we were to use a config option - then we would have one class but and if/else statement in the process method handling the two different calculations.
I personally thought a separate class is cleaner, but after all - you are the boss ;)
| if mpiutil.rank0: | ||
| print("m, time needed for quadratic pse", m, et - st) |
There was a problem hiding this comment.
This looks like left over debug statements. Either remove it, or at least improve the formatting.
There was a problem hiding this comment.
Would be good to keep, but agree about improving formatting
| if mpiutil.rank0: | ||
| print("m, time needed for quadratic pse", m, et - st) |
There was a problem hiding this comment.
Would be good to keep, but agree about improving formatting
| et = time.time() | ||
| if mpiutil.rank0: | ||
| print("m, time needed for quadratic pse", m, et - st) |
There was a problem hiding this comment.
| et = time.time() | |
| if mpiutil.rank0: | |
| print("m, time needed for quadratic pse", m, et - st) | |
| et = time.time() | |
| self.log.debug(f"{m=}, time needed for quadratic pse {et - st}") |
A quadratic estimator that is distributed over power spectrum bands.
feat(QuadraticPSEstimationXLarge):