Skip to content
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-36211: Add PeekExposureTask #75

Merged
merged 1 commit into from
Feb 12, 2024
Merged

DM-36211: Add PeekExposureTask #75

merged 1 commit into from
Feb 12, 2024

Conversation

jmeyers314
Copy link
Contributor

Adds PeekExposureTask as a solution to quickly find the brightest source (for observing scripts), and also quickly estimate PSF moments along xy, altaz, and equitorial axes.

@jmeyers314 jmeyers314 changed the title Tickets/dm 36211 DM-36211: Add PeekExposureTask Dec 11, 2023
@jmeyers314 jmeyers314 force-pushed the tickets/DM-36211 branch 4 times, most recently from a9b1465 to c6f62ed Compare December 11, 2023 22:28
@jmeyers314
Copy link
Contributor Author

Started addressing flake8 failures reported here, then noticed that at some of my original formatting was apparently set by running first isort then black. Am I wrong to think that black ought to produce acceptable whitespace-around-: and linebreak-before-binary-operator rules? (Some of the other flake8 complaints are definitely legitimate though...)

@jmeyers314 jmeyers314 force-pushed the tickets/DM-36211 branch 2 times, most recently from 0a9c447 to 3126d57 Compare December 11, 2023 22:46
@jmeyers314
Copy link
Contributor Author

Looks like the setup.cfg could set W503 under ignore as documented here? And E203 is mentioned here

Though I'm unsure if lsst-sitcom doesn't follow the same dev guide as lsst maybe?

@mfisherlevine
Copy link
Contributor

It does (currently, intend to) follow the same dev guide, yes. But it's not black and isorted (yet), and there are places where black and flake8 are mutually exclusive, in that black will autoformat things into a state that is not compatible with having an empty flake8 ignore-list, and the ignores picked by, for example, middleware packages, are not the same as those in pipelines, which is what this package follows. It's all a bit of a mess, but yes, the tl;dr is that black will, with the current configs, fight with flake8.

@mfisherlevine
Copy link
Contributor

The easiest thing to do is to fixup those problems by hand for now, sorry. In the future, once I've merged some large tickets, we'll black and isort everything, but I need to merge some monster tickets because otherwise I'll be rebase hell.

@jmeyers314
Copy link
Contributor Author

Well, easiest may be to just add W503 and E203 to https://github.com/lsst-sitcom/summit_utils/blob/main/setup.cfg#L4 (If I'm reading the dev guide right, then I think W503 should be added regardless of any potential black transition). But I'm happy to do either.

Copy link
Contributor

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hitting Approve because I don't know what the standards are for this package, or more importantly where the balance is between standing something up quickly and being able to maintain it, and so I'm happy to defer to the author on that. There are issues here that I'd consider a maintenance problem if the code was going into lsst_distrib.

python/lsst/summit/utils/assessPeekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/assessPeekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/assessPeekExposure.py Outdated Show resolved Hide resolved
default=50,
doc="Maximum binning factor for donut mode",
)
# override installSimplePsf with donut kernel here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a TODO entry that was suppose to happen on this branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More of: started working on it, decided I didn't need it, but didn't want to lose the partial progress. So my tentative plan was to commit it, and then delete it so it at least lives on in git history.

python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved


# retrieve best-effort-isr and run PET on it
def doit(idx, row, doPlot):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and initializer() both need docstrings, especially as this is some of the weirder bits of the code. Also, I'd rename them both tbh: initializer sounds like a class, the function would more likely be verb, and doit() could at least be called doWork do runTask or something?

python/lsst/summit/utils/assessPeekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Show resolved Hide resolved
self.log.warn("No sources found in spec mode.")
if self.config.doPhotoFallback:
self.log.warn("Falling back to photo mode.")
result = self.photo.run(exposure, nobin=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, is this the only reason nobin exists? If so then I think it's fine to leave it as-is, and just have the binning controlled by the binning factor then (as people can just use 1 for no binning). Out of interest though, why is this necessarily not binned? Because in this case we're known to be struggling, and therefore our best chance of winning is to go totally unbinned?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think I remember now. It's because having passed through self.spec.run, the exposure is already binned, so this is to prevent binning it a second time...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although, the clone() was supposed to prevent that? I'll have to trace through to be certain...

python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
python/lsst/summit/utils/peekExposure.py Outdated Show resolved Hide resolved
@mfisherlevine
Copy link
Contributor

Lots of quite picky comments from me, sorry. Generally, this package follows the DM dev guide as closely as is reasonably possible (and it's generally possible to follow it completely 🙂).

@mfisherlevine
Copy link
Contributor

Also, and this one is really annoying, but this package is in camelCase, and this is bringing in a mix of snake and camel. Hopefully a quick find & replace can fix that up and not be too onerous?! 😬 Sorry!

@jmeyers314 jmeyers314 force-pushed the tickets/DM-36211 branch 2 times, most recently from 175349e to 9bc73c8 Compare February 9, 2024 01:43
@jmeyers314 jmeyers314 merged commit 96a40da into main Feb 12, 2024
1 check passed
@jmeyers314 jmeyers314 deleted the tickets/DM-36211 branch February 12, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants