Avoid circular import between flexure and specobj,specobjs#2084
Avoid circular import between flexure and specobj,specobjs#2084kbwestfall merged 18 commits intopypeit:developfrom
flexure and specobj,specobjs#2084Conversation
profxj
left a comment
There was a problem hiding this comment.
Definitely a bit "dirtier" in places, but now the base extraction codes are much more Pythonic.
I didn't look carefully at the code that shuffled between modules (or into new ones). Am assuming those lines didn't change much.
kbwestfall
left a comment
There was a problem hiding this comment.
Thanks for the review!
|
Lots of test failures, but they look they were all because of 1 of 2 issues. These are now fixed, and I have restarted the tests. |
|
Still some lingering test failures: I cannot reproduce the |
debora-pe
left a comment
There was a problem hiding this comment.
Thanks @kbwestfall for all this hard work. This looks good.
I just had one general thought. It feels to me that explicitly filling out sobj.OPT_WAVE, sobj.OPT_COUNTS, sobj.OPT_COUNTS_IVAR, etc...every time that extract_optimal and extract_boxcar are used is (besides clunky) going to be difficult to maintain. I was wondering if we could create a function that update sobj with the outputs from extract_optimal and extract_boxcar ?
Not sure if that could be in the SpecObj class or in a separate file with all SpecObj related "operations", but in this way we would avoid to have to change all the methods that use extract_optimal and extract_boxcar whenever we make a change to their code.
|
Dev-suite is still failing on the bok_bc data: The vet test failure is because it can't find the I'll try to investigate the |
|
Hi @kbwestfall . I run the Dev-Suite on my machine. The other funny thing it's that I did not get a failure for |
|
Everything passed (again) except for the coadd vet test: I think it may be because of a difference between the directory structure in the cloud and a local install. In pypeit/PypeIt-development-suite#392, I changed all the uses of |
Thanks @kbwestfall! |
|
Tests pass! |
This PR does a few things to avoid circular imports among
flexure,specobj, andspecobjsand to modularize the code a little more:MultiSlitFlexureclass inpypeit/core/flexure.pyinto its own module,pypeit/multislit_flexure.py. This avoids the need to importspecobjsinpypeit/core/flexure.py.pypeit/core/extract.pyrelated to modeling the spatial profile of the object into a separate module,pypeit/core/spatialprofile.py.specobjinextract.extract_boxcarandextract.extract_optimal. This makes the return signatures more complicated, but it means that you don't need to construct aSpecObjobject to use the low-level extraction functions.flexure.get_sky_spectrumso that it didn't useSpecObj.I performed detailed tests along the way to make sure that the extracted spectra before and after the changes to the extraction algorithms yielded identical results.