-
Notifications
You must be signed in to change notification settings - Fork 0
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
pre-release updates #42
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ad49694
updated config file
s0larish da094ca
updated functions, alpha, conversions
s0larish 19eed8c
Update _config.yml
s0larish e118d0f
Update _config.yml
s0larish 1d5aaa6
Updated the functions
s0larish 77b0640
Updated test for updated functions
s0larish e3736b9
Update test_core.py
s0larish f7072a7
Update CI.yml
jmbhughes f1cb414
Create weeklypr.yaml
jmbhughes 3c265c1
Update alpha.py
s0larish a9761e2
Update polarizers.py
s0larish b1c5949
updated test_polarizers.py
s0larish 4b51c40
Update _config.yml
s0larish 8a15756
Delete solpolpy/.DS_Store
jmbhughes 2985412
Update .gitignore to ignore DS_Store
jmbhughes 78263f5
removed old code
jmbhughes c258d83
cleaned up formatting
jmbhughes 86556cf
Delete .DS_Store
jmbhughes b2b907a
Delete docs/.DS_Store
jmbhughes 07e9194
Delete tests/.DS_Store
jmbhughes 566ec43
removes unused tests
jmbhughes 05bf0d6
adds fourpol test
jmbhughes 6fd1e71
fix #35
jmbhughes 78c45d0
fix typo
jmbhughes 3ff5464
correct test to use proper function
jmbhughes 01f97fa
fix test
jmbhughes 81ac828
fixes keys to float for fourpol
jmbhughes 2cbf7e7
fixed fourpol test
jmbhughes 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
Binary file not shown.
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
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,13 @@ | ||
on: | ||
schedule: | ||
- cron: '0 0 * * THU' | ||
name: weekly PR | ||
jobs: | ||
createPullRequest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: create pull request | ||
run: gh pr create -B main -H develop --title 'Weekly merge to develop' --body 'Created by Github action' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
|
@@ -127,4 +127,4 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
tests/.DS_Store | ||
*.DS_Store |
Binary file not shown.
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
Binary file not shown.
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 |
---|---|---|
|
@@ -27,9 +27,8 @@ | |
x = np.arange(-x_size // 2, x_size // 2) | ||
y = np.arange(-y_size // 2, y_size // 2) | ||
xx, yy = np.meshgrid(x, y) | ||
# return np.fliplr(np.arctan2(yy, xx))*u.radian | ||
return np.flipud(np.rot90(np.fliplr(np.arctan2(yy, xx) + np.pi), k=1))* u.radian | ||
|
||
return np.rot90(np.fliplr(np.arctan2(yy, xx)+np.pi), k=1)*u.radian | ||
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. This is not covered by tests. I notice most of the alpha.py file isn't. Let's write some tests and also make proper docstrings. |
||
|
||
|
||
def zeros(shape): | ||
return np.zeros(shape) | ||
|
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
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
jmbhughes marked this conversation as resolved.
Show resolved
Hide resolved
|
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 |
---|---|---|
@@ -1,71 +1,37 @@ | ||
|
||
from typing import List | ||
|
||
from ndcube import NDCube, NDCollection | ||
from astropy.io import fits | ||
from astropy.wcs import WCS | ||
|
||
|
||
def load_data(path_list: List[str]) -> NDCollection: | ||
""" | ||
path_list: String of path list where group of files to be loaded is present. | ||
default_alpha: bool, optional | ||
If default_alpha is true the alpha matrix will be referenced from Solar North. Default is True. | ||
Make it False to provide alpha (in FITS format) with same size as of input data | ||
or select the alpha matrix (from the list). | ||
Parameters | ||
---------- | ||
path_list: List[str] | ||
list of paths to be loaded | ||
|
||
Returns | ||
------- | ||
NDCollection | ||
The data are loaded as NDCollection object with WCS and header information available. | ||
The keys are labelled as 'angle_1', 'angle_2, 'angle_3', ... | ||
Alpha matrix is also added apart from the polarizing angles data and can be accessed through 'alpha' key. | ||
The keys are labeled as 'angle_1', 'angle_2, 'angle_3', ... | ||
""" | ||
|
||
# create list of FITS | ||
fits_type = [] | ||
|
||
# get length of list to determine how many files to process. | ||
list_len = len(path_list) | ||
assert list_len >= 2, 'requires at least 2 FITS files' | ||
|
||
for xlist_item in path_list: | ||
with fits.open(xlist_item) as hdul: | ||
fits_type.append(hdul[0].header['DETECTOR']) | ||
|
||
if len(set(fits_type)) != 1: | ||
raise Exception("Input FITS are of different types") | ||
|
||
|
||
data_out = [] | ||
i = 0 | ||
|
||
for data_path in path_list: | ||
for i, data_path in enumerate(path_list): | ||
with fits.open(data_path) as hdul: | ||
i = i+1 | ||
wcs = WCS(hdul[0].header) | ||
data_out.append(("angle_" + str(i), NDCube(hdul[0].data, wcs=wcs, meta=hdul[0].header))) | ||
# size = hdul[0].data.shape | ||
# if default_alpha: | ||
# alph = radial_north(size) | ||
# data_out.append(("alpha", NDCube(alph, wcs=wcs))) | ||
# else: | ||
# inp = input("Do you wish to provide an alpha array?").lower() | ||
# if inp.startswith('n'): | ||
# print("Continuing with default options... Waiting for input...") | ||
# inp_ref = input("Choose the reference along the Solar: \"North\" or \"West\":").lower() | ||
# if inp_ref.startswith('n'): | ||
# alpha = radial_north(size) | ||
# else: | ||
# alpha = radial_west(size) | ||
# data_out.append(("alpha", NDCube(alpha, wcs=wcs, meta=hdul[0].header))) | ||
# elif inp.startswith('y'): | ||
# print("Provide the alpha matrix in FITS format") | ||
# alpha_path = input("Provide the path of alpha FITS file:") | ||
# hdu = fits.open(alpha_path) | ||
# if np.max(hdu[0].data) > 2 * np.pi + 1: | ||
# alph = hdu[0].data * deg2rad | ||
# else: | ||
# alph = hdu[0].data | ||
# data_out.append(("alpha", NDCube(alph, wcs=wcs, meta=hdu[0].header))) | ||
|
||
print("Hurray!!! Data loaded successfully.") | ||
data_out.append(("angle_" + str(i), | ||
NDCube(hdul[0].data, | ||
wcs=wcs, | ||
meta=hdul[0].header))) | ||
|
||
return NDCollection(data_out, meta={}, aligned_axes="all") |
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
Binary file not shown.
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.
We shouldn't leave commented out code.