Passing a WCSTransform type variable to a function calling world_to_pix, and called under a Distributed.pmap command #62
Unanswered
fpaletou-hub
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Is there a particular error you are experiencing? The following example usage of Distributed works without error: using Distributed: pmap, @everywhere
@everywhere begin
using WCS: WCSTransform, world_to_pix
# Generic WCS
wcs = WCSTransform(2)
# Some target function
f(coords) = world_to_pix(wcs, coords)
# Make matrix with dimensions (2, Nstars) of coordinates
Nstar = 100
ra = rand(Nstar) * 360
dec = (rand(Nstar) .- 0.5) .* 180
mycoords = stack([ra, dec]; dims=1)
# Make a vector of coordinate matrices for parallel processing
# by repeating mycoords
# Type is Vector{Matrix{Float64}}
p_mycoords = [mycoords for _ in 1:5]
end
result1 = f(mycoords) # Works
result2 = pmap(f, p_mycoords) # Works
# Check that each entry in result2 is equal to result1
all(i == result1 for i in result2) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear colleagues,
I'm having a hard time trying to figure out how to properly pass (as an argument) a WCSTransform type variable to a function (into which I use world_to_pix), and that I want to run on several cores using a Distributed.pmap command.
May I expect something wrong because of the very WCSTransform type, for instance?
Thanx
Beta Was this translation helpful? Give feedback.
All reactions