AllenInstitute / bmtk

Brain Modeling Toolkit
https://alleninstitute.github.io/bmtk/
BSD 3-Clause "New" or "Revised" License
266 stars 86 forks source link

ECP module not recording consistently #321

Open GregGlickert opened 1 year ago

GregGlickert commented 1 year ago

I am recording a biophysical model's ECP using the ECP module

  "reports": {
    "ecp1": {
      "cells": {"pop_name": "PV"},
      "variable_name": "v",
      "module": "extracellular",
      "tmp_dir": "$OUTPUT_DIR",
      "electrode_positions": "$COMPONENTS_DIR/recXelectrodes/linear_electrode.csv",
      "file_name": "ecp_pv1.h5",
      "electrode_channels": "all",
      "contributions_dir": "ecp_pv1"
      },
    "ecp2": {
      "cells": {"pop_name": "PV"},
      "variable_name": "v",
      "module": "extracellular",
      "tmp_dir": "$OUTPUT_DIR",
      "electrode_positions": "$COMPONENTS_DIR/recXelectrodes/linear_electrode.csv",
      "file_name": "ecp_pv2.h5",
      "electrode_channels": "all",
      "contributions_dir": "ecp_pv2"
      },
    "ecp3": {
      "cells": "all",
      "variable_name": "v",
      "module": "extracellular",
      "tmp_dir": "$OUTPUT_DIR",
      "electrode_positions": "$COMPONENTS_DIR/recXelectrodes/linear_electrode.csv",
      "file_name": "ecp_all1.h5",
      "electrode_channels": "all",
      "contributions_dir": "ecp_all1"
      },
    "ecp4": {
      "cells": "all",
      "variable_name": "v",
      "module": "extracellular",
      "tmp_dir": "$OUTPUT_DIR",
      "electrode_positions": "$COMPONENTS_DIR/recXelectrodes/linear_electrode.csv",
      "file_name": "ecp_all2.h5",
      "electrode_channels": "all",
      "contributions_dir": "ecp_all2"
      }
  },

Then when I compare either the two ECPs that recorded only PV cells or the two ECPs that recorded all cells the signal is different. The signal looks largely the same but once closes examined it's clear that it is different. To analysis the output I did

import h5py
import matplotlib.pyplot as plt
%matplotlib inline

path1  = "outputECP1/ecp_pv1.h5"
path2 = "outputECP1/ecp_pv2.h5"

f1 = h5py.File(path1)
f2 = h5py.File(path2)

fig, ax = plt.subplots(2,1,figsize=(15,4.8))
ax[0].plot(f1["ecp/data"][:])
ax[0].title.set_text("PV recording 1")
ax[0].set_xlim(4000,5000)
ax[1].plot(f2["ecp/data"][:])
ax[1].title.set_text("PV recording 2")
ax[1].set_xlim(4000,5000)

plt.show()

The result was

output

You can see that the signals are different when they recorded the same thing.