Extracting edits to the level2 graph¶
Get a more detailed change log for a root ID¶
We provide a utility function for combining the output of a CAVEclient
's
chunkedgraph.get_tabular_change_log
and chunkedgraph.get_operation_details
.
Note
This probably belongs in CAVEclient
from caveclient import CAVEclient
from paleo import get_detailed_change_log
root_id = 864691135639556411
client = CAVEclient("minnie65_phase3_v1")
change_log = get_detailed_change_log(root_id, client, filtered=False)
change_log.iloc[:, :5]
Get the changes to the level2 graph for a specific edit¶
edit_id = change_log.index[0]
edit_id
import time
from paleo import get_operation_level2_edit
currtime = time.time()
l2_edit = get_operation_level2_edit(edit_id, client)
print(f"{time.time() - currtime:.3f} seconds elapsed.")
This returns a paleo.NetworkDelta
object. This is a lightweight class for storing
what edges/nodes are added/removed by an operation, as well as (optionally) a dictionary
of arbitrary metadata.
l2_edit
Get the changes to the level2 graph for multiple edits¶
With the current set of endpoints and design of the chunkedgraph, it is faster to get a list of changes using this function rather than putting paleo.get_operation_level2_edit in a loop.
from paleo import get_operations_level2_edits
currtime = time.time()
l2_edits = get_operations_level2_edits(change_log.index, client)
print(f"{time.time() - currtime:.3f} seconds elapsed.")
This returns a dictionary, where the keys are the operation IDs and the values are
the corresponding paleo.NetworkDelta
objects.
Get the changes to the level2 graph for all edits to a root ID¶
We get even more of a speedup if all of those changes are from the history of one root
ID. Again, this is just because of the way current endpoints are structured (some of
the information we need is available from CAVEclient.chunkedgraph.get_tabular_change_log
).
from paleo import get_root_level2_edits
currtime = time.time()
l2_edits = get_root_level2_edits(root_id, client)
print(f"{time.time() - currtime:.3f} seconds elapsed.")
Combine edits that affect the same points on the level2 graph¶
Often it is helpful to combine edits that affect the same points on the level2 graph. This can be useful for finding things like edits that were undone by later edits.
Currently, this function defines metaedits as those that affect the same points on the level2 graph (more specifically, connected components in a graph where nodes are edits and edges are shared points on the level2 graph). In the future, this could support other schemes for defining metaedits.
from paleo import get_metaedits
metaedits, metaedit_mapping = get_metaedits(l2_edits)
metaedits[23]
member_edits = metaedit_mapping[23]
for edit in member_edits:
print(list(l2_edits[edit].added_nodes))
metaedits[23].added_nodes