Load output

[1]:
from pathlib import Path

import denest.io.load
[2]:
OUTPUT_DIR = Path('./data/outputs/output')

Version information

[3]:
!cat {OUTPUT_DIR/'versions.txt'}
denest=1.0.1
NEST nest-2.20.0

Start and end time for each session

[4]:
# Load the start and end time for each session
session_times = denest.io.load.load_session_times(OUTPUT_DIR)
print(session_times)  # {<session_name>: (<session_start>, <session_end>)}
{'00_warmup': (0.0, 100.0), '01_3_spikes': (100.0, 200.0), '02_2_spikes': (200.0, 300.0), '03_3_spikes': (300.0, 400.0)}

Load data from a specific recorder

Relevant information about a recorder and the population it’s connected to are contained in its metadata file

[5]:
recorder_metadata_path = OUTPUT_DIR/'data/my_multimeter_l1_l1_exc.yml'

recorder_metadata = denest.io.load.load_yaml(recorder_metadata_path)
print(f'Metadata : {recorder_metadata}')
Metadata : {'colnames': ['gid', 'time', 'V_m'], 'filenames': ['my_multimeter_l1_l1_exc-203-0.dat'], 'gids': [53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152], 'interval': 20.0, 'label': 'my_multimeter_l1_l1_exc', 'layer_name': 'l1', 'layer_shape': (5, 5), 'locations': None, 'population_name': 'l1_exc', 'population_shape': (5, 5, 4), 'record_from': ['V_m'], 'type': 'multimeter', 'units_number': 4}

Load a recorder’s data as pandas dataframe by providing the path to its metadata file

[6]:
df = denest.io.load.load(recorder_metadata_path)
print(df[0:5])
2020-06-30 13:43:45,101 [denest.io.load] INFO: Loading metadata from data/outputs/output/data/my_multimeter_l1_l1_exc.yml
   gid   time     V_m
0   53  120.0 -54.457
1   54  120.0 -54.457
2   55  120.0 -54.457
3   56  120.0 -54.457
4   57  120.0 -54.457

Get all the recorders’ metadata with denest.io.load.metadata_paths()

[7]:
all_recorder_metadata_paths = denest.io.load.metadata_paths(OUTPUT_DIR)
print(all_recorder_metadata_paths)
[PosixPath('data/outputs/output/data/my_multimeter_l1_l1_exc.yml'), PosixPath('data/outputs/output/data/my_spike_detector_input_layer_parrot_neuron.yml'), PosixPath('data/outputs/output/data/weight_recorder_proj_1_AMPA-l1-l1_exc-l1-l1_inh.yml')]
[8]:
for metadata_path in all_recorder_metadata_paths:
    print(f'Recorder: {metadata_path.name}')
    print(f'{denest.io.load.load(metadata_path)[0:5]}\n')
2020-06-30 13:43:45,178 [denest.io.load] INFO: Loading metadata from data/outputs/output/data/my_multimeter_l1_l1_exc.yml
2020-06-30 13:43:45,204 [denest.io.load] INFO: Loading metadata from data/outputs/output/data/my_spike_detector_input_layer_parrot_neuron.yml
2020-06-30 13:43:45,220 [denest.io.load] INFO: Loading metadata from data/outputs/output/data/weight_recorder_proj_1_AMPA-l1-l1_exc-l1-l1_inh.yml
Recorder: my_multimeter_l1_l1_exc.yml
   gid   time     V_m
0   53  120.0 -54.457
1   54  120.0 -54.457
2   55  120.0 -54.457
3   56  120.0 -54.457
4   57  120.0 -54.457

Recorder: my_spike_detector_input_layer_parrot_neuron.yml
   gid   time
0   27  102.0
1   28  102.0
2   29  102.0
3   30  102.0
4   31  102.0

Recorder: weight_recorder_proj_1_AMPA-l1-l1_exc-l1-l1_inh.yml
    0    1      2      3   4
0  53  187  104.5  0.898 NaN
1  53  159  104.5  0.898 NaN
2  53  184  104.5  0.898 NaN
3  53  199  104.5  0.898 NaN
4  53  153  104.5  0.898 NaN