dbbs-lab / bsb-core

The Brain Scaffold Builder
https://bsb.readthedocs.io
GNU General Public License v3.0
22 stars 16 forks source link

Redo of connectivity rule removes also placement #763

Closed drodarie closed 1 year ago

drodarie commented 1 year ago

Attached is a small configuration example to test the redo flag of network.compile.

from bsb.config import Configuration
import bsb.options
from bsb.core import Scaffold

bsb.options.verbosity = 3
cfg = Configuration({
  "name": "DBBS Mouse cerebellum configuration v4.0",
  "storage": {
    "engine": "hdf5",
    "root": "network.hdf5"
  },
  "network": {
    "x": 50.0,
    "y": 50.0,
    "z": 50.0,
    "chunk_size": [50, 50, 50]
  },
  "partitions": {
    "layer": {
    "thickness": 50.0,
    "stack_index": 0
    },
  },
  "regions": {
    "cerebellar_cortex": {
      "type": "stack",
      "children": ["layer"]
    }
  },
    "cell_types": {
      "cell": {
        "spatial": {
          "radius": 1,
          "density": 8e-5,
        },
      },
    },
    "placement": {
      "layer_placement": {
        "strategy": "bsb.placement.RandomPlacement",
        "partitions": ["layer"],
        "cell_types": ["cell"]
      }
    },

    "connectivity": { 
      "cell_to_cell": {
        "strategy": "bsb.connectivity.AllToAll",
        "presynaptic": {
          "cell_types": ["cell"]
        },
        "postsynaptic": {
          "cell_types": ["cell"]
        },
      },
    },  

  "after_placement": {  },

  "simulations": {

    }
  })

network = Scaffold(cfg)
# network.compile(clear=True)
network.compile(skip_placement=True, skip_after_placement=True, redo=["cell_to_cell"])

First results when performing network.compile(clear=True)

Compiling the following strategies: layer_placement, cell_to_cell
Clearing data
Starting placement strategies: layer_placement
Queued 1 jobs for layer_placement
Placing 10 cell in [0 0 0]
Starting connectivity strategies: cell_to_cell
Queued 1 jobs for cell_to_cell
Runtime: 0.011723041534423828 2

Then comment this line and un-comment the line network.compile(skip_placement=True, skip_after_placement=True, redo=["cell_to_cell"])

Compiling the following strategies: layer_placement, cell_to_cell
Redo-affected placement: layer_placement
Redo-affected connectivity: cell_to_cell
Clearing all data of cell
Clearing connectivity data of cell
Starting connectivity strategies: cell_to_cell
Queued 1 jobs for cell_to_cell
Runtime: 0.0033278465270996094 2

The placement of the layer is redone despite skip_placement. The network does not contain any cells (previously was 10).