-
Notifications
You must be signed in to change notification settings - Fork 18
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
Generalize the definition of Map and Alm #26
Conversation
Codecov Report
@@ Coverage Diff @@
## master #26 +/- ##
==========================================
- Coverage 80.92% 80.89% -0.04%
==========================================
Files 18 18
Lines 755 764 +9
==========================================
+ Hits 611 618 +7
- Misses 144 146 +2
Continue to review full report at Codecov.
|
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.
I think it's very reasonable to read Array{T,1}
from disk, since that is really the type that other HEALPix libraries operate on.
Before this is merged, it may be helpful to copy and paste the existing tests for map and alm but substitute |
This commit removes several trailing whitespaces as well.
Hey @ziotom78, I've tested it out a bit, could it be possible to Alm{T}(lmax, mmax, arr) where {T <: Number} =
Alm{T, Array{T, 1}}(lmax, mmax, collect(arr)) with this one Alm(lmax, mmax, arr::AA) where {T <: Number, AA <: AbstractArray{T,1}} =
Alm{T, AA}(lmax, mmax, arr) Then you don't have to repeat the array type twice if you're constructing something, and collect is unnecessary since we are no longer based on alms = [Alm{ComplexF64}(lmax, mmax, zeros(ComplexF64, nalms)),
Alm{ComplexF64}(lmax, mmax, zeros(ComplexF64, nalms)),
Alm{ComplexF64}(lmax, mmax, zeros(ComplexF64, nalms))] Since the constructor can already dispatch on the element type of the input array as well as the array type passed, this can be simplified to
|
Nice idea @xzackli, I like it! I had to modify several calls to |
@xzackli, what do you think about the PR? If it looks good, I can merge it. |
This looks great, these are some exciting changes! |
This is a WIP to address issue #24 opened by @xzackli. The definition of
Map
andAlm
have been modified, and nowAA <: AbstractArray{T, 1}
has been added to the list of parameters for these two parametric types.The PR tries to preserve compatibility with old code by adding new constructors for
Map
andAlm
that assumeAA = Array{T, 1}
. As a result, I only had to do minimal changes to the test cases.What is still missing is to decide how should functions that create
Map
orAlm
objects behave (e.g., whenreadMapFromFITS
returns a map loaded from disk, which kind of array should create?). At the moment I chose to useArray{T, 1}
types, but comments are accepted!Things to do:
Map
Alm
SharedArray
objects