-
Notifications
You must be signed in to change notification settings - Fork 7
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
Compatibility with complex object such as YAXArrays #254
Comments
Yeah, check out the But I'm not sure what you mean by simple and complex objects ? Like mathematical complex? That should totally work. As for YAX I pretty much always use some kind of Maybe be a bit more specific about what |
By simple object, I mean that tuple and matrix are common and from base JULIA. I name complex object such as YAXArrays or raster that are build from the simple object and add features useful in specific task. |
I basically always use a (so maybe post some code that doesn't work and we can workshop it) |
The issue I got is that I need to interact between multiple and growing number of arrays. I'm developing a mechanistic spatial evolutionary model with a growing number of species overtime and interaction between these species. And I can't see how to make it work by using YAXArrays to keep all species in the same object to be able to pick either all cell of a species or all species in a cell But for now I have an error |
By using YAX I think you just mean DimensionalData.jl ? Rather than YAX disk-based tools? YAX dimensions are just DD dimensions extended for Zarr and similar. They are supported here, but not how you think. You cant have a dimension of an array in a simulation, it breaks the abstraction. It will just try to run in 3d! The init array defines the dimensionality of the space. I guess we could actually allow those to not be the same thing and pass in a view over the extra dimensions? But you wont be easily able to grow the array to add new species anyway (julia multidimensional arrays don't change size)... so the actual efficient (and reccomended) way to do this is use some kind of StaticArray. So StaticArrays.jl, and LabelledArrays.jl has a labelled version. Then you allocated the maximum length vector up-front and track how many things are in it as a run-time variable. So make a struct with a StaticArray in it, and a number saying how many things it holds. Like this: struct Species{A}
species::A
nspecies::Int
end
Base.zero(::Species{A,N}) = Species(zero(species.species), 0) I use a StaticArray like this for about 50 species in some simulations. If you need 1000, yes you will need something else, likely not DynamicGrids.jl in its current form. (Additionally if you want to post errors please post MWEs and the full stack trace, then I can actually help) |
Sorry for the error
and the traceback:
DynamicGrids is version 0.21.4 |
Yeah, use the |
I use the |
Ok sorry I will check this later on |
Oops this is just a discrepancy between Stencils.jl which uses Use using DynamicGrids, ColorSchemes, Colors, BenchmarkTools
const DEAD, ALIVE, BURNING = 1, 2, 3
init = fill(ALIVE, 400, 400)
bench_output = ResultOutput(init; tspan=1:200)
setneighbors_rule = let prob_combustion=0.0001, prob_regrowth=0.01
SetNeighbors(Moore(1)) do data, neighborhood, cell, I
if cell == DEAD
if rand() <= prob_regrowth
data[I...] = ALIVE
end
elseif cell == BURNING
for pos in indices(neighborhood, I)
if data[pos...] == ALIVE
data[pos...] = BURNING
end
end
data[I...] = DEAD
elseif cell == ALIVE
if rand() <= prob_combustion
data[I...] = BURNING
end
end
end
end
sim!(bench_output, setneighbors_rule) |
I want use dispersion in a complex macroevolution simulation. To do so, I use YAXArrays to handle the high dimensionnality of the data in a spatial context. Then, there is a version compatibility issue between DynamicGrids and YAXArrays. DynamicGrids only work on JULIA version 1.9 whereas YAXArrays need JULIA version 1.10.
Then DynamicGrids only take simple object as input which reduce the application possibility for complex scenari.
Is there any development plan for this kind of issue ?
The text was updated successfully, but these errors were encountered: