Closed Martin-Rey closed 2 years ago
I don't think there is a particular reason that numpy arrays are ignored. It's probably an oversight, and an extra condition should be added.
I see. I'm happy to add a further test to include numerical numpy arrays.
As a curiosity, is the rest of Tangos forbidding non-numerical properties? I don't think I ever tried, but I couldn't store a boolean, or a string in the database?
The actual mechanism by which things are stored in the database is all here:
https://github.com/pynbody/tangos/blob/master/tangos/core/data_attribute_mapper.py
Currently there aren't any mechanisms for strings or booleans. Of course a boolean could be stored as an int...
Hi @apontzen and @mtremmel ,
I have a case where I would like to import a numpy array as a pre-calculated property through the
tangos-import
command. However, the code here https://github.com/pynbody/tangos/blob/1d7e837b731e974087ceda4bcb61a1730be0243a/tangos/tools/property_importer.py#L34-L46 can only take float or integer values and will skip any other import otherwise.Numpy arrays are pretty generic across other Tangos properties (a centre in x, y, z for example, or a pre-calculated density profile) but they will get skipped every time by this exclusion loop. Is there a reason why array properties cannot be currently imported through the
tangos-import
command (or anything else than float and integers for that matter)?Best, Martin