Closed silviafeltrin closed 3 years ago
Currently there are no public APIs in v3.6 to perform the seperate write operations you're looking for. Instead the scaffold
object needs to be tricked into believing there`s only 1 placement/connectivity set in the entire network and it will write just that.
So a bit of a hacky workaround. Instead of compile_output
try this:
# Storing a single connection type
with h5py.File(filename_h5, "a") as f:
cells_group = f["cells"]
# Name of the type
tag = "mossy_to_glomerulus"
# Remove the other conn types from the scaffold so no other write operations are attempted
scaffold.cell_connections_by_tag = {tag: scaffold.cell_connections_by_tag[tag]}
# Remove any previous data if it exists
if f"connections/{tag}" in cells_group:
del cells_group[f"connections/{tag}"]
if f"connection_compartments/{tag}" in cells_group:
del cells_group[f"connection_compartments/{tag}"]
if f"connection_morphologies/{tag}" in cells_group:
del cells_group[f"connection_morphologies/{tag}"]
# Perform the single-type write operation
scaffold.output_formatter.store_cell_connections(cells_group)
Ok, thanks, I tried, but still there are some errors:
Ah sorry, there were some typos in my previous post, try copy pasting the previous code again.
Ok thank you!
Does it work now?
yes
Good morning, I have some issues in addiing a new connection type on an existing .hdf5 file containing only the results of the placement. I used the function from_hdf5 to run the new connection from the existing .hdf5 file, but how to save the new connection on the .hdf5? I tried to write 'scaffold.compile_output() ' but it gave me error:
Here you can find the source code, the .hdf5 file and the .json file used: https://polimi365-my.sharepoint.com/:f:/g/personal/10527301_polimi_it/Em-cUGZJdiNKgdQKWRhBQJwBntpgXf5Ukh-o0vLD5Y8Jig?e=pQr0Xx