Skip to content

Commit

Permalink
modified: Julia/fits.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jvo203 committed Sep 29, 2021
1 parent 940336c commit 3435026
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 36 deletions.
42 changes: 8 additions & 34 deletions Julia/fits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2855,40 +2855,6 @@ end
mask .= 0
end

# LZ4-compress {pixels,mask} for a faster transmission from the remote worker
# to the root process (network bandwidth savings)
dims = size(pixels)
pixels = lz4_compress(collect(flatten(pixels)))
mask = lz4_compress(collect(flatten(mask)))

#=
try
# make an element-by-element write-enabled copy
pixels = deepcopy(frame_pixels)
catch e
println("frame_pixels: ", e)
return
end
mask = map(isnan, pixels)
try
# replace NaNs with 0.0
pixels[mask] .= 0.0
catch e
println("pixels: ", e)
return
end
try
# invert the mask
mask = .!mask
catch e
println("mask: ", e)
return
end
=#

if bDownsize
try
# tried using Threads.@spawn: imresize does not seem to be thread-safe
Expand Down Expand Up @@ -2944,6 +2910,8 @@ end
"-->($image_width,$image_height); ",
typeof(pixels),
";",
size(mask),
"-->($image_width,$image_height); ",
typeof(mask),
)
return
Expand All @@ -2952,6 +2920,12 @@ end

# println(typeof(pixels), ";", typeof(mask), ";", size(pixels), ";", size(mask), "; bDownsize:", bDownsize)

# LZ4-compress {pixels,mask} for a faster transmission from the remote worker
# to the root process (network bandwidth savings)
dims = size(pixels)
pixels = lz4_compress(collect(flatten(pixels)))
mask = lz4_compress(collect(flatten(mask)))

return (pixels, mask, dims)
end

Expand Down
34 changes: 32 additions & 2 deletions Julia/scratchpad.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# reduce (integrate) the image
pixels = @distributed (+) for i = 1:depth

local val , pixels
local val, pixels

try
fits_file = FITS(filepath)
Expand Down Expand Up @@ -195,4 +195,34 @@ try
OpenEXR.save_exr(filename, image, channels)
catch e
println(e)
end
end

# fetchVideoFrame
#=
try
# make an element-by-element write-enabled copy
pixels = deepcopy(frame_pixels)
catch e
println("frame_pixels: ", e)
return
end
mask = map(isnan, pixels)
try
# replace NaNs with 0.0
pixels[mask] .= 0.0
catch e
println("pixels: ", e)
return
end
try
# invert the mask
mask = .!mask
catch e
println("mask: ", e)
return
end
=#
#

0 comments on commit 3435026

Please sign in to comment.