Skip to content

Commit

Permalink
Merge pull request #1 from dpabon/dpabon-patch-max_cache
Browse files Browse the repository at this point in the history
Update DAT.jl
  • Loading branch information
dpabon authored Sep 22, 2023
2 parents 6abb756 + 5abe33f commit 71e2575
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/DAT/DAT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ Map a given function `fun` over slices of the data cube `cube`.
Use InDims to discribe the input dimensions and OutDims to describe the output dimensions of the function.
### Keyword arguments
* `max_cache=YAXDefaults.max_cache` maximum size of blocks that are read into memory, defaults to approx 10Mb
* `indims::InDims` List of input cube descriptors of type [`InDims`](@ref) for each input data cube
* `outdims::OutDims` List of output cube descriptors of type [`OutDims`](@ref) for each output cube
* `max_cache=YAXDefaults.max_cache` String. e.g. ```max_cache="10MB" or ```max_cache=1GB``` maximum size of blocks that are read into memory, defaults to approx 10Mb.
* `indims::InDims` List of input cube descriptors of type [`InDims`](@ref) for each input data cube.
* `outdims::OutDims` List of output cube descriptors of type [`OutDims`](@ref) for each output cube.
* `inplace` does the function write to an output array inplace or return a single value> defaults to `true`
* `ispar` boolean to determine if parallelisation should be applied, defaults to `true` if workers are available.
* `showprog` boolean indicating if a ProgressMeter shall be shown
Expand Down Expand Up @@ -434,6 +434,18 @@ function mapCube(
do_gc = true,
kwargs...,
)
if max_cache != YAXArrays.YAXDefaults.max_cache[]
if last(max_cache, 2) == "MB"
max_cache = parse(Float64, max_cache[begin:end-2]) / (10^-6)

Check warning on line 439 in src/DAT/DAT.jl

View check run for this annotation

Codecov / codecov/patch

src/DAT/DAT.jl#L438-L439

Added lines #L438 - L439 were not covered by tests

elseif last(max_cache, 2) == "GB"

Check warning on line 441 in src/DAT/DAT.jl

View check run for this annotation

Codecov / codecov/patch

src/DAT/DAT.jl#L441

Added line #L441 was not covered by tests

max_cache = parse(Float64, max_cache[begin:end-2]) / (10^-9)

Check warning on line 443 in src/DAT/DAT.jl

View check run for this annotation

Codecov / codecov/patch

src/DAT/DAT.jl#L443

Added line #L443 was not covered by tests

else
error("only MB or GB values are accepted for max_cache")

Check warning on line 446 in src/DAT/DAT.jl

View check run for this annotation

Codecov / codecov/patch

src/DAT/DAT.jl#L446

Added line #L446 was not covered by tests
end
end

#Translate slices
if any(i -> isa(i, YAXSlice), cdata)
Expand Down

0 comments on commit 71e2575

Please sign in to comment.