Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard-coded baseline correction #997

Open
katduecker opened this issue Feb 14, 2025 · 0 comments
Open

Hard-coded baseline correction #997

katduecker opened this issue Feb 14, 2025 · 0 comments

Comments

@katduecker
Copy link
Collaborator

katduecker commented Feb 14, 2025

The different resting membrane potentials in the apical_tuft and soma of the L5 pyramidal cells cause a non-zero dipole at rest. Additionally, the compartments are not initialized at their resting membrane potentials, which causes an initial "drift" in the dipole.

The baseline correction is hard-coded in dipole.py https://github.com/jonescompneurolab/hnn-core/blob/master/hnn_core/dipole.py#L611

This baseline correction will not work for new models.

I understand we don't want to add a baseline correction to each simulation based on a buy-in interval, as this would add a lot of time and compute to each simulation.

As a current work-around, I have run my new model for 5 seconds (could do 10) without any inputs, stored the L2 and L5 dipoles and time vector in a .json file, which is then subtracted during a baseline correction.


def _baseline_renormalize_ca(self):
        """Baseline correction based on calcium model without drives"""

        hnn_core_root = op.dirname(hnn_core.__file__)

        # load the baseline dipole
        with open(op.join(hnn_core_root, 'param', 'bsl_dipole_ca.json'), 'r') as f:
            bsl_dpl = json.load(f)

        # subtract baseline dipole from the current dipole
        for i,t in enumerate(self.times):
            bsl_idx = np.argmin(np.abs(bsl_dpl['times'] - t))
            self.data['L2'][i] -= bsl_dpl['L2'][bsl_idx]
            self.data['L5'][i] -= bsl_dpl['L5'][bsl_idx]
        
        self.data['agg'] = self.data['L2'] + self.data['L5']

I have further added an option to simulate_dipole to select a baseline correction method, which defaults to jones (the original correction)


def simulate_dipole(net, tstop, dt=0.025, n_trials=None, record_vsec=False,
                    record_isec=False, record_ca=False, postproc=False, bsl_cor='jones')

Again, this is just a work-around that works for my current purposes, and I'm happy to discuss ideas for a more permanent solution.

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

No branches or pull requests

1 participant