-
-
Notifications
You must be signed in to change notification settings - Fork 49
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 tests with a jsoc cutout file and update MGN to convert int to float #215
Conversation
95113e3
to
03da3d7
Compare
41daef1
to
6667eff
Compare
80f9d85
to
bd778e0
Compare
42a55b1
to
e36cba5
Compare
e511b03
to
9e2dfd8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
de4eecf
to
4cb4a41
Compare
38cf515
to
80c7c3e
Compare
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.
This is jut a end of file character change.
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.
This is jut a end of file character change.
ecc31e0
to
16d6fd9
Compare
for s, weight in zip(sigma, weights, strict=True): | ||
# 2 & 3 Create kernel and convolve with image | ||
# Refer to equation (1) in the paper | ||
ndimage.gaussian_filter(data, sigma=s, truncate=truncate, mode="nearest", output=conv) | ||
|
||
# 4. Calculate difference between image and the local mean image, | ||
# square the difference, and convolve with kernel. Square-root the | ||
# resulting image to give `local standard deviation` image sigmaw | ||
# Refer to equation (2) in the paper | ||
conv = data - conv | ||
ndimage.gaussian_filter(conv**2, sigma=s, truncate=truncate, mode="nearest", output=sigmaw) | ||
np.sqrt(sigmaw, out=sigmaw) |
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.
> np.sqrt(sigmaw, out=sigmaw)
E numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'sqrt' output from dtype('float32') to dtype('int16') with casting rule 'same_kind'
So this is the original issue that we need to fix.
To fix this, I just always cast the input data to float32.
Fixes #211
Issue was reported with JSOC cutouts and the datatype breaking these routines.