Hello fine fellows!
I’m trying to use StructArrays for a custom data layout. Basically, I would like the following to produce a StructArray that includes the parameters field:
using StructArrays
struct MyStruct
data::Dict
end
struct MyData
parameters::Array
end
p = [1,2]
p2 = [3,4]
s1 = MyStruct(Dict(:MyData => MyData(p)))
s2 = MyStruct(Dict(:MyData => MyData(p2)))
StructArray([s1, s2])
If done naively like above, it does not include the parameters field
I know that I have to overload the getproperty(ms::MyStruct)
function and then overload the StructArrays.staticschema
and StructArrays.createinstance
(example here) functions in order for StructArrays to include the parameters
field.
Can anyone point me in the right direction?
Thanks! /Robin