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

Save cell vars to nwb #79

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

VBaratham
Copy link

Work from NWB Hackathon 2019, using the nwb simulation extension.

Tested with the following script:

from pynwb import NWBFile, NWBHDF5IO
from datetime import datetime
from nwbext_simulation_output import CompartmentSeries, Compartments


CELLS = [
    (0, [0, 1, 2, 3, 4], [.1, .2, .3, .4, .5]),
    (1, [0, 1, 2, 3], [.1, .2, .3, .4]),
    (2, [0, 1, 2, 3, 4, 5], [.1, .2, .3, .4, .5, .6]),
    (3, [0, 1, 2, 3, 4, 5], [.1, .2, .3, .4, .5, .6]),
]

BUFFER_SIZE = 10

if __name__ == '__main__':

    recorder = cell_vars.CellVarRecorderNWB('test.nwb', '~/src/bmtk/tmp', ['vm', 'im'])

    for gid, sec_list, seg_list in CELLS:
        recorder.add_cell(gid, sec_list, seg_list)
    
    recorder.tstop = 0.1
    recorder.initialize(100, buffer_size=BUFFER_SIZE)

    for i in range(100):
        for gid, sec_list, seg_list in CELLS:
            recorder.record_cell(gid, 'vm', [i]*len(seg_list), i)
            recorder.record_cell(gid, 'im', [i]*len(seg_list), i)

        if (i+1) % BUFFER_SIZE == 0:
            recorder.flush()
    
    recorder.close()

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.

None yet

1 participant