-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
ccd_tempreture taking astropy unit #150
Open
Abinash-bit
wants to merge
50
commits into
sunpy:main
Choose a base branch
from
Abinash-bit:ccd-temp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
eda4374
ccd_tempreture taking astropy unit
Abinash-bit 7b4f3f3
Update sunkit_instruments/suvi/suvi.py
Abinash-bit 9625f71
Update sunkit_instruments/suvi/suvi.py
Abinash-bit 33d13fa
Update sunkit_instruments/suvi/suvi.py
Abinash-bit 85f3ff6
Adding unit tests for get_response
Abinash-bit 5ddc1b0
updates
Abinash-bit 752a01d
Fixing precommit
Abinash-bit fc20b49
Adding the changelog
Abinash-bit fcbd964
again fixing the precommit
Abinash-bit 55acee0
Adding the quantity decorators and removing the manual checks
Abinash-bit 7e74533
Correcting changelog
Abinash-bit 832b89c
Coming back to the code base where test cases did not fail so that i …
Abinash-bit 2277451
Just Changes
Abinash-bit 119f05b
updates
Abinash-bit 7b0e0e8
May be proceeding towards final script
Abinash-bit e5c8160
Fixing pre-commit
Abinash-bit 5da93f3
Update changelog/150.feature.3.rst
Abinash-bit c47016c
Passing all the test cases
Abinash-bit dc30d6f
Changes in changelog too
Abinash-bit d8b1cae
Checking precommit
Abinash-bit 4f2a35b
Merge branch 'main' into ccd-temp
Abinash-bit cca132c
Addressing the comments
Abinash-bit 37c05d6
Resolving conflicts
Abinash-bit d7f11bb
Update sunkit_instruments/suvi/suvi.py
Abinash-bit 0340232
addressing comments
Abinash-bit 89c08d7
Resolving conflicts
Abinash-bit 4e5fd72
Addressing comments
Abinash-bit 22c8f7c
Addressing comments
Abinash-bit 427ada4
precommit-fix
Abinash-bit 49d11b6
Resolving final comments
Abinash-bit 0b1de6a
back to the changes
Abinash-bit e1b7abf
fixing codestyle and resolving commits
Abinash-bit c2d1899
precommit-fix
Abinash-bit c98c627
Update sunkit_instruments/suvi/suvi.py
Abinash-bit 6084b6c
Adding line space in test_suvi.py
Abinash-bit eb45e53
resolving conflicts
Abinash-bit 64148c9
Update sunkit_instruments/suvi/tests/test_suvi.py
Abinash-bit f2bf28a
Update sunkit_instruments/suvi/tests/test_suvi.py
Abinash-bit 9436955
Update sunkit_instruments/suvi/tests/test_suvi.py
Abinash-bit c203be7
Update sunkit_instruments/suvi/tests/test_suvi.py
Abinash-bit 26a0548
precommit-fix
Abinash-bit 4337ea4
resolving conflicts
Abinash-bit 89e9221
addressing old comments
Abinash-bit 35e03e0
Update sunkit_instruments/suvi/suvi.py
Abinash-bit 91063ca
addressing old comments
Abinash-bit 85689ee
Resolving conflicts
Abinash-bit f0d5c8d
Update sunkit_instruments/suvi/suvi.py
Abinash-bit 8fd73da
just precommit
Abinash-bit 70d6339
resolving conflicts
Abinash-bit c99b66f
Changing the name of the changelog
Abinash-bit 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 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 @@ | ||
Updated `~.get_response` to enforce ``ccd_temperature`` as an `astropy.units.Quantity` |
This file contains 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 @@ | ||
Updated `~.get_response` to enforce ``ccd_temperature`` as an `astropy.units.Quantity` |
This file contains 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 |
---|---|---|
|
@@ -100,8 +100,8 @@ | |
""" | ||
return _despike(data, dqf, filter_width) | ||
|
||
|
||
def get_response(request, spacecraft=16, ccd_temperature=-60.0, exposure_type="long"): | ||
@u.quantity_input(ccd_temperature=u.deg_C) | ||
def get_response(request, spacecraft=16, ccd_temperature=-60.0 * u.deg_C, exposure_type="long"): | ||
""" | ||
Get the SUVI instrument response for a specific wavelength channel, | ||
spacecraft, CCD temperature, and exposure type. | ||
|
@@ -113,13 +113,13 @@ | |
|
||
Parameters | ||
---------- | ||
request: `str` or {94 | 131 | 171 | 195 | 284 | 304}. | ||
request: `str` or {94, 131, 171, 195, 284, 304} | ||
Either an L1b filename (FITS or netCDF), or an integer | ||
specifying the wavelength channel. | ||
spacecraft: `int`, optional. | ||
Which GOES spacecraft, default is 16. | ||
ccd_temperature: `float`, optional. | ||
The CCD temperature, in degrees Celsius, default is -60. | ||
ccd_temperature: `astropy.units.Quantity` | ||
The CCD temperature, in degrees Celsius, default is ``-60.0 * u.deg_C``. | ||
Needed for getting the correct gain number. | ||
exposure_type: {"long" | "short" | "short_flare"}, optional. | ||
The exposure type of the SUVI image. | ||
|
@@ -156,7 +156,8 @@ | |
header, _, _ = read_suvi(request) | ||
wavelength_channel = int(header["WAVELNTH"]) | ||
spacecraft = int(header["TELESCOP"].replace(" ", "").replace("G", "")) | ||
ccd_temperature = (header["CCD_TMP1"] + header["CCD_TMP2"]) / 2.0 | ||
ccd_temp_avg = (header["CCD_TMP1"] + header["CCD_TMP2"]) / 2.0 | ||
ccd_temperature = ccd_temp_avg * u.deg_C | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we redefine |
||
exposure_type = "_".join( | ||
header["SCI_OBJ"].replace(" ", "").split(sep="_")[3:] | ||
).replace("_exposure", "") | ||
|
@@ -195,7 +196,7 @@ | |
temp_x = gain_table[:, 0] | ||
gain_y = gain_table[:, 1] | ||
gain_vs_temp = interpolate.interp1d(temp_x, gain_y) | ||
gain = gain_vs_temp(ccd_temperature) | ||
gain = gain_vs_temp(ccd_temperature.to(u.deg_C).value) | ||
|
||
geometric_area = 19.362316 * u.cm * u.cm | ||
solid_angle = ((2.5 / 3600.0 * (np.pi / 180.0)) ** 2.0) * u.sr | ||
|
@@ -210,7 +211,7 @@ | |
"response": response, | ||
"wavelength_channel": wavelength_channel, | ||
"spacecraft": "GOES-" + str(spacecraft), | ||
"ccd_temperature": ccd_temperature * u.deg_C, | ||
"ccd_temperature": ccd_temperature, | ||
"exposure_type": exposure_type, | ||
"flight_model": FLIGHT_MODEL[spacecraft], | ||
"gain": float(gain), | ||
|
This file contains 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this file.