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-43297: Update streaming sequence finder for new file layout #34

Merged
merged 6 commits into from Mar 13, 2024

Conversation

mfisherlevine
Copy link
Contributor

No description provided.

data[seqNum] = [filename]
else:
data[seqNum].append(filename)
if dayObs < 20240311:
Copy link
Contributor

Choose a reason for hiding this comment

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

A quick comment as to the significance of this date would be nice (even if just for future you?!)

else:
data[seqNum].append(filename)
else:
# dirs here isn't the fully dirname, it's just the base dirname
Copy link
Contributor

Choose a reason for hiding this comment

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

"fully dirname"?!

So...call it baseDirs?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I've gone for dirNames and also improved the comment (which also contained a typo).

@@ -297,6 +298,7 @@ def findFastStarTrackerImageSources(filename, boxSize, attachCutouts=True):
The sources in the image, sorted by rawFlux.
"""
exp = openFile(filename)
expTime = exp.visitInfo.exposureTime # defaults to nan if not set
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this evaluate to if it's "not set"? I.e. would it raise or is exposureTIme guaranteed to be in exp.visitInfo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's guaranteed to be there (I think this is from our C++), and returns nan for all the cases I tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, maybe the comment is ambiguous. What I meant was "if the upstream code hasn't set this, this attribute will be nan and so the expTime will become nan in that case".

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hopefully this all gets simpler once someone writes the metadata translator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Someone will need to write a repackager first...

@@ -81,7 +81,7 @@ def getStreamingSequences(dayObs):
elif site == "summit":
rootDataPath = "/project"
else:
raise ValueError(f"StarTracker data isn't available at {site}")
raise ValueError(f"Finding StarTracker data isn't supported at {site}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the added "Finding" really help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it doesn't mean that the data isn't there, or that the data itself is unsupported (what would that even mean), just that the fancy auto-locate this data thing won't work.

# dirs here isn't the fully dirname, it's just the base dirname
dirs = sorted(d for d in os.listdir(dataDir) if os.path.isdir(os.path.join(dataDir, d)))
for d in dirs:
files = sorted(glob.glob(os.path.join(dataDir, d, "*.fits")))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll take your word for it that you really want to list all the .fits files 😀

Copy link
Collaborator

@timj timj Mar 13, 2024

Choose a reason for hiding this comment

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

Consider using ResourcePath.findFileResources to find them (with the advantage that it works on object stores as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do 🙂 Also, all this will be in the butler soon (I am told) so this is almost throw-away code (and that's also why it's in summit_extras)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm never going to look in S3 for this, and like you say, one day this will just be a butler.get for a single object.

@mfisherlevine mfisherlevine merged commit a7fd225 into main Mar 13, 2024
4 checks passed
mfisherlevine added a commit that referenced this pull request Mar 15, 2024
DM-43297: Update streaming sequence finder for new file layout
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.

None yet

3 participants