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

Add TableRow #472

Merged
merged 3 commits into from
May 17, 2024
Merged

Add TableRow #472

merged 3 commits into from
May 17, 2024

Conversation

jmeyers314
Copy link
Member

Adds a custom InputType for the galsim config machinery to parse an astropy QTable. My current use case is to grab one row of the table for each AOS operations rehearsal 4 (OR4) exposure (example here), so this is similar to the OpsimData class. I wanted to be able to leverage units and structured array columns though, and lose some of the other peculiarities of OpSimData.

It's possible this would fit in better in GalSim than ImSim. Wherever it ends up, it should be part of a tag/release soonish I think for OR4 reproducibility.

@jmeyers314 jmeyers314 requested a review from rmjarvis May 15, 2024 20:02
Copy link
Contributor

@rmjarvis rmjarvis left a comment

Choose a reason for hiding this comment

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

This feels a little to specific a use case to put in GalSim proper. Probably imSim is a good home for it. But if you want, you could also submit it to galsim_extra if you think people outside of the imSim user community might want to use it.

type_name="ExposureData",
gen_func=ExposureData,
valid_types=[float, int, bool, str, galsim.Angle, list],
input_type="exposure_table",
Copy link
Contributor

Choose a reason for hiding this comment

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

The "Exposure" part of the name seems too specific to your use case. This feels like it should be more generic, like AstropyTableRow or QTableRow or even just TableRow. Something like that. The implementation doesn't have anything to do with exposures.

It also took me a couple reads to understand that you're just pulling out a single row from the full table. So it feels like that should be part of the name.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I think I actually had AstropyTableRow at one point during development and changed it (can't remember why now). I landed on TableRow and RowData now.

galsim.config.RemoveCurrent(config["input"]["exposure_table"])
galsim.config.ProcessInput(config)
idx = idx0 * 2 + idx1
check_exp_data(config, idx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than just checking explicit calls to ExposureData, it's probably also worth adding some values in the config itself that use the input type. Things that use { 'type': 'ExposureData', 'field': ... }, since that's the syntax that users will actually use.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I added a test that actually creates a batoid telescope, similar to what I'm doing for OR4.

@jmeyers314 jmeyers314 changed the title Add ExposureTable Add TableRow May 16, 2024
@jmeyers314
Copy link
Member Author

This feels a little to specific a use case to put in GalSim proper. Probably imSim is a good home for it. But if you want, you could also submit it to galsim_extra if you think people outside of the imSim user community might want to use it.

Sure, ImSim is fine for now. Can always migrate later if that's useful.

@jmeyers314
Copy link
Member Author

Assuming this passes CI, I think it's ready for another look @rmjarvis .

@jmeyers314 jmeyers314 merged commit e74a93e into main May 17, 2024
3 checks passed
@jmeyers314 jmeyers314 deleted the exposure_table branch May 17, 2024 16:38
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