CAVEconnectome / CAVEclient

This is the python client for accessing REST APIs within the Connectome Annotation Versioning Engine.
https://caveconnectome.github.io/CAVEclient/
MIT License
19 stars 12 forks source link

fixes issues with lineage graph filtering with client side filtering #125

Closed fcollman closed 8 months ago

fcollman commented 8 months ago

This is necessary on v1 at least where timestamp filtering does not appear to give the result one would want.

root_ts = client.chunkedgraph.get_root_timestamps(root_id)[0]
mat_timestamp=client.materialize.get_version_metadata(version=630)['time_stamp']
lineage_graph= client.chunkedgraph.get_lineage_graph(root_id, timestamp_past=root_ts,
                                                     timestamp_future=mat_timestamp)
print(f'root_ts: {root_ts} mat_timestamp: {mat_timestamp}')
for node in lineage_graph['nodes']:
    node_ts= datetime.datetime.fromtimestamp(node['timestamp'])
    node_ts=node_ts.astimezone(datetime.timezone.utc)
    if ( (node_ts<mat_timestamp) or (node_ts>root_ts)):
        print(node, node_ts)