-
Notifications
You must be signed in to change notification settings - Fork 13
Implement simplified IFU mode with cube readout #654
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
Merged
Merged
Changes from 28 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
281a1eb
Hack in 3D image plane
teutoburg a673a76
Hack in `DetectorList3D`
teutoburg 0c0d1c6
Add warning if cube waves and fov wave disjoint
teutoburg 78661a9
Remove obsolete `FovVolumeList.detector_limits`
teutoburg 0b2bd8b
Add `DetectorList3D` to effects considered spectroscopic
teutoburg ed92094
Copy detector WCS to FOV cube in 3D mode, add WCS early
teutoburg e83f546
Generalise `overlay_image()` for 3D case
teutoburg 5afe2d6
Generalise `add_imagehdu_to_imagehdu()` for 3D case
teutoburg c73991f
Enable `DetectorList3D` to shrink FOV in 3D
teutoburg a53e3b3
Fix spectral off-by-one error
teutoburg 780666b
Override `detector_headers()` for 3D case
teutoburg 3ff4a87
Add zeros_from_header utils function
teutoburg 9cb1b17
Use `zeros_from_header()` for `Detector` to solve 3D case
teutoburg a5babe0
Skip sky WCS for 3D case
teutoburg 167d90b
Also use `zeros_from_header()` in `ImagePlane`
teutoburg 81f5558
Refactor `DetectorList3D` and parent class
teutoburg f98b1bf
Get rid of unused fov_grid method
teutoburg 52060ee
Hack sky wcs into cube output
teutoburg 9605c97
Add `FluxBinning3D` effect
teutoburg 02f1e17
Add test for DetectorList3D
teutoburg a7c3119
Add simple ifu mode to basic instrument
teutoburg f33fe05
Add more tests
teutoburg 903d885
More refactoring in `DetectorList`
teutoburg af071b3
Silly single item tuple needs a quacking comma -.-
teutoburg d362417
Merge branch 'main' into fh/simple-ifu
teutoburg f4df92b
Use BUNIT in ImagePlane
teutoburg 25fd23d
Bumping version from 0.10.0a0 to 0.10.0a1
teutoburg 0d20a9d
More BUNIT fixes
teutoburg 7a0ba5d
Reduce kwargs
teutoburg 7bd7500
Add psf log msg
teutoburg b13a82c
Make unit conversion more robust
teutoburg ee95138
Clarify pixel scale conversions
teutoburg 6635d92
Prevent unexpected keyword argument, add logging
teutoburg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [tool.poetry] | ||
| name = "ScopeSim" | ||
| version = "0.10.0a0" | ||
| version = "0.10.0a1" | ||
| description = "Generalised telescope observation simulator" | ||
| license = "GPL-3.0-or-later" | ||
| authors = ["Kieran Leschinski <[email protected]>"] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # -*- coding: utf-8 -*- | ||
| """Where else to put this?.""" | ||
|
|
||
| from typing import ClassVar | ||
|
|
||
| from astropy import units as u | ||
|
|
||
| from .effects import Effect | ||
| from ..optics.fov import FieldOfView | ||
| from ..utils import get_logger, from_currsys, unit_includes_per_physical_type | ||
|
|
||
|
|
||
| logger = get_logger(__name__) | ||
|
|
||
|
|
||
| class FluxBinning3D(Effect): | ||
| """Takes care of cube flux conversion in absence of a SpectralTraceList.""" | ||
|
|
||
| z_order: ClassVar[tuple[int, ...]] = (690,) | ||
|
|
||
| def apply_to(self, fov, **kwargs): | ||
| """See parent docstring.""" | ||
| if not isinstance(fov, FieldOfView): | ||
| return fov | ||
|
|
||
| if fov.hdu is None or fov.hdu.header["NAXIS"] != 3: | ||
| logger.error("Cannot apply cube flux binning.") | ||
| return fov | ||
|
|
||
| bunit = u.Unit(fov.hdu.header["BUNIT"].lower()) | ||
| pixel_area = fov.pixel_area * u.arcsec**2 | ||
|
|
||
| # Spatial binning | ||
| if unit_includes_per_physical_type(bunit, "solid angle"): | ||
| fov.hdu.data *= pixel_area.value | ||
| bunit *= pixel_area.unit | ||
| else: | ||
| logger.warning("Cube is already binned spatially.") | ||
|
|
||
| # Spectral binning | ||
| if unit_includes_per_physical_type(bunit, "length"): | ||
| fov.hdu.data *= self.dwave.value | ||
| bunit *= self.dwave.unit | ||
| else: | ||
| logger.warning("Cube is already binned spectrally.") | ||
|
|
||
| fov.hdu.header["BUNIT"] = bunit.to_string("fits") | ||
|
|
||
| # This is done in SpectralTraceList as well, idk... | ||
| fov.cube = fov.hdu | ||
| return fov | ||
|
|
||
| @property | ||
| def dwave(self) -> u.Quantity[u.um]: | ||
| # TODO: turn into class attribute once cmds lookup works... | ||
| dwave = from_currsys("!SIM.spectral.spectral_bin_width", self.cmds) | ||
| return dwave << u.um | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.