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-47777: Write interface for SOAR seeing data #50

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mfisherlevine
Copy link
Contributor

No description provided.

@mfisherlevine mfisherlevine force-pushed the tickets/DM-47777 branch 4 times, most recently from 966a91c to 44969d7 Compare November 27, 2024 07:30
Copy link

@ctslater ctslater left a comment

Choose a reason for hiding this comment

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

Mostly philosophical comments.

return None

@staticmethod
def adjustCoords(coords, height):
Copy link

Choose a reason for hiding this comment

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

"Adjust" is super vague and any explanation of what this is doing would help.

See comment below about staticmethod.

results = self.reader.readtext(dateImage, detail=0)
dateString = " ".join(results).strip()
# replace common OCR errors
dateString = dateString.replace(".", ":")
Copy link

Choose a reason for hiding this comment

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

Clever. But for loop here.

return astopyTime

@staticmethod
def thresholdImage(image, threshold):
Copy link

Choose a reason for hiding this comment

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

All of these static methods are basically internal, so I would probably make them free functions and not export them.

def thresholdImage(image, threshold):
return image.point(lambda x: 0 if x < threshold else 255, "L")

def _preprocessImage(self, image):
Copy link

Choose a reason for hiding this comment

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

A one sentence description will help the future reader.

imageBwNumpy = np.array(imageBw).astype(np.uint8)
return imageBwNumpy

def _getSeeingNumber(self, image) -> float:
Copy link

Choose a reason for hiding this comment

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

This seems more like _ocrImage()?


SOAR_IMAGE_URL = "http://www.ctio.noirlab.edu/~soarsitemon/soar_seeing_monitor.png"

STORE_FILE = {
Copy link

Choose a reason for hiding this comment

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

Hard coding this here seems like it's going to make this difficult to run in any other situation. I think it's better if these classes take filenames as parameters, and then the RA script specifies the full paths.

self._reload()
return self.rowToSeeingConditions(self.df.iloc[-1])

def getSeeingForDataId(self, butler: Butler, dataId: DataCoordinate) -> SeeingConditions:
Copy link

Choose a reason for hiding this comment

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

I have a philosophical disagreement with this and getSeeingForExpRecord; this class doesn't need to know how to do butler things at all.

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.

2 participants