-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
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,51 @@ | ||
import numpy as np | ||
import astropy.units as u | ||
|
||
|
||
# TODO: make sure these have up/solar north as the reference of 0 degrees | ||
|
||
|
||
def radial90(shape): | ||
''' | ||
assumes solar north is to the left - useful for STEREO | ||
creates radial polarization map | ||
''' | ||
x_size, y_size = shape | ||
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.rot90(np.arctan2(yy, xx), k=1))*u.radian | ||
|
||
|
||
def radial_west(shape): | ||
''' | ||
assumes solar north is up | ||
creates radial polarization map | ||
''' | ||
x_size, y_size = shape | ||
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.flipud(np.fliplr(np.arctan2(yy, xx) + np.pi))*u.radian | ||
|
||
def radial_north(shape): | ||
''' | ||
assumes solar north is up | ||
creates radial polarization map | ||
''' | ||
x_size, y_size = shape | ||
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 | ||
# | ||
|
||
def zeros(shape): | ||
return np.zeros(shape) | ||
|
||
|
||
ALPHA_FUNCTIONS = {'radial_north': radial_north, | ||
'radial_west': radial_west, | ||
'radial90': radial90, | ||
'zeros': zeros} |