Skip to content

Conversation

@Matthijspals
Copy link
Contributor

@Matthijspals Matthijspals commented Oct 28, 2025

We should not filter NaNs and branch points out of jaxnodes.edges / synapses:

but just use tree_map helper functions that only apply the filtering functions fn to leaves with keys in valid_keys (those that are in jaxnodes.keys())

def tree_map_leaves_with_valid_key(tree, fn, valid_keys=None):
    """
    Apply fn(leaf) selectively to leaves that satisfy is_valid_membrane_leaf(key, leaf, valid_keys).
    """
    return tree_map_with_path(
        lambda path, leaf: (
            fn(leaf)
            if is_valid_membrane_leaf(get_key_name(path), leaf, valid_keys)
            else leaf
        ),
        tree,
    )

@Matthijspals Matthijspals changed the title Michael2 Make build_dynamic_state_utils compatible with networks Oct 28, 2025
@michaeldeistler michaeldeistler merged commit f36bdaa into matthijs2 Nov 21, 2025
@michaeldeistler michaeldeistler deleted the michael2 branch November 21, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants