New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-10728: write photometric fit results as a PhotoCalib with a custom BoundedField #15
Conversation
For the "Fix interpolation bugs in getFCorImg and getJImg. " commit, while I appreciate that you'd rather not split out the formatting fixes, it is really difficult as is to disentangle the two, especially without knowing the exact nature of the bugs being fixed. If you really don't want to split this into two commits (I'm not going to force it), could you at least spell out to some degree in the commit message what the nature of the interpolation bugs were and the fixes made? When I look at the images in your unittest, I do see some very strange patterns in the difference images that are different for each Also, I note that many of the formatting changes involve adding spaces around the multiplication and division operators. While it is only in Python that these should never be surrounded by whitespace (https://developer.lsst.io/coding/python_style_guide.html#binary-operators-should-be-surrounded-by-a-single-space-except-for vs. https://developer.lsst.io/coding/cpp_style_guide.html#the-following-white-space-conventions-should-be-followed), most of the other instances in this file omit the spaces, so this formatting change is not only not required, but makes the file slightly less internally consistent. Again, since this repo is probably more heterogeneous and guideline-violating than most in terms of format and style, I won't force your hand one way or the other, but thought I'd at least point it out. |
50c8e6f
to
2cae5d0
Compare
I've just pushed a rebase that splits off the indentation changes from the commit that fixes the interpolation bugs. A (mostly positive) side effect is that I've run clang-format on the entirety of those two files in the whitespace-only commit, which adds a lot of new changes, but you should now be able to see just the interpolation fixes in the following commit. I believe the differences between the images produced by the old meas_mosaic code and the new code are down to the following:
|
dataRef.put(exp, "fcr") | ||
except Exception as e: | ||
print "failed to write fcr: %s" % (e) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this this try...except
block is duplicated. Also, can you also change "something ==> wcs" at line 637 above?
errField.getElementCount()) | ||
newErrField = errField.__class__(newName + sigmaName, | ||
"Calibrated magnitude error from %s (%s)" % | ||
(errField.getName(), errField.getDoc()), "mag") | ||
newErrKeys[newName] = mapper.addMapping(errKeys[name + sigmaName], newErrField) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it is true that LSST no longer uses array fields for flux values, I'm pretty sure this was allowing for data processed with the old-time HSC stack to be updated (e.g. aperture corrections are stored in an array field). I'm not sure if we will ever have a use case for running this on such an archaic processing run, the rest of the repo still accommodates it, so adding only this adaptation without removing all the others may lead to confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was already broken by the time I got to it: getElementCount
was never intended to be a public method, and it isn't anymore (as of the pybind11 port, I believe). So fixing this code would require rewriting it to avoid that check. Given that we shouldn't need to run the new version of meas_mosaic against the outputs of older versions of the rest of the pipeline anymore, I don't think that's worthwhile.
@@ -1,21 +1,21 @@ | |||
#include <strings.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh...looks like including this in this file commit reverts what you did on the clang-cleanup commit!#$!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad you noticed these, and I'm embarrassed I didn't. Should be fixed now.
src/fluxfit.cc
Outdated
@@ -201,7 +201,7 @@ Eigen::VectorXd fluxFit_rel(std::vector<Obs::Ptr> &m, int nmatch, std::vector<Ob | |||
} | |||
} | |||
|
|||
int ncoeff_offset = 3; // Fit from 2nd order only | |||
int ncoeff_offset = 3; // Fit from 2nd order only | |||
// In some cases (small number of visits or small dithering), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reverting the formatting done on the clang-cleanup commit: lsst-dm/ancient-legacy-meas_mosaic@0caf217#diff-55b138c02dda9dcf23718ad652bf219eR204
src/fluxfit.cc
Outdated
@@ -963,7 +963,7 @@ Eigen::VectorXd fluxFit_abs(std::vector<Obs::Ptr> &m, int nmatch, std::vector<Ob | |||
} | |||
} | |||
|
|||
int ncoeff_offset = 1; // Fit from 1st order only | |||
int ncoeff_offset = 1; // Fit from 1st order only | |||
FluxFitParams::Ptr p = ffpSet[ffpSet.begin()->first]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | ||
* LSST Data Management System | ||
* Copyright 2008-2016 AURA/LSST. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2017
@@ -672,7 +672,40 @@ def writeFcr(self, dataRefList): | |||
try: | |||
dataRef.put(exp, "fcr") | |||
except Exception as e: | |||
print "failed to write something: %s" % (e) | |||
print "failed to write fcr: %s" % (e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code has to be ported to support python3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the point of this work is to enable us to retire meas_mosaic (by demonstrating that Jointcal is an adequate replacement), I'd rather not spend time on that.
07ea342
to
24cbbab
Compare
clang-format doesn't do things as nicely as I would have done by hand, but it's infinitely better than the non-indented nests of for-loops and mix of tabs and spaces we had before.
24cbbab
to
87d34c9
Compare
87d34c9
to
6ae3801
Compare
Includes titles, scaling, and mask transparency for the images displayed on ds9 as well as an option to pause and drop into the pdb debugger to allow for inspection of the displayed images.
6ae3801
to
33302a9
Compare
This hides all of the messy rotation logic inside a new C++ class,
FluxFitBoundedField
, and puts the results in a format that jointcal could also use. When combined with the newPhotoCalib
class, this should provide everything we need to use the photometric fit results. This ticket currently tests the behavior of this class against the existing routines inupdateExposure.py
; a future ticket could now remove those routines in favor of simpler operations onPhotoCalib
(though we may want to add a bit more toPhotoCalib
and/orBoundedField
to make that easier, such as mixed operations betweenBoundedField
andMaskedImage
).