Проблема с набором данных. Значения в кодах AllenSDK

Я начинающий пользователь кодов AllenSDK. Я выполнил процедуру установки, описанную на их веб-сайте, установив также все связанные зависимости. Я попытался создать простой пример кода, приведенный в https://alleninstitute.github.io/AllenSDK/glif_models.html . Мой тестовый код следующий

      #---------------------------
#1° DOWNLOAD OF THE DATA
#---------------------------
from allensdk.api.queries.glif_api import GlifApi
from allensdk.core.cell_types_cache import CellTypesCache
import allensdk.core.json_utilities as json_utilities

neuronal_model_id = 566302806

# download model metadata
glif_api = GlifApi()
nm = glif_api.get_neuronal_models_by_id([neuronal_model_id])[0]

# download the model configuration file
nc = glif_api.get_neuron_configs([neuronal_model_id])[neuronal_model_id]
neuron_config = glif_api.get_neuron_configs([neuronal_model_id])
json_utilities.write('neuron_config.json', neuron_config)

# download information about the cell
ctc = CellTypesCache()
ctc.get_ephys_data(nm['specimen_id'], file_name='stimulus.nwb')
ctc.get_ephys_sweeps(nm['specimen_id'], file_name='ephys_sweeps.json')
#------------------------------------------------------------------------

#------------------------------
#2° RUNNING A GLIF SIMULATION
#------------------------------
import allensdk.core.json_utilities as json_utilities
from allensdk.model.glif.glif_neuron import GlifNeuron

# initialize the neuron
neuron_config = json_utilities.read('neuron_config.json')['566302806']
neuron = GlifNeuron.from_dict(neuron_config)

# make a short square pulse. stimulus units should be in Amps.
stimulus = [ 0.0 ] * 100 + [ 10e-9 ] * 100 + [ 0.0 ] * 100

# important! set the neuron's dt value for your stimulus in seconds
neuron.dt = 5e-6

# simulate the neuron
output = neuron.run(stimulus)

voltage = output['voltage']
threshold = output['threshold']
spike_times = output['interpolated_spike_times']

#-------------------------------
#3° SIMULATE THE MODEL'S TRACES
#-------------------------------
import allensdk.core.json_utilities as json_utilities

from allensdk.model.glif.glif_neuron import GlifNeuron
from allensdk.model.glif.simulate_neuron import simulate_neuron

neuron_config = json_utilities.read('neuron_config.json')['566302806']
ephys_sweeps = json_utilities.read('ephys_sweeps.json')
ephys_file_name = 'stimulus.nwb'

neuron = GlifNeuron.from_dict(neuron_config)

sweep_numbers = [ s['sweep_number'] for s in ephys_sweeps if s['stimulus_units'] == 'Amps' ]
sweep_numbers = sweep_numbers[:2] # for the sake of a speedy example, just run the first one
simulate_neuron(neuron, sweep_numbers, ephys_file_name, ephys_file_name, 0.05)

Код вроде работает, но только в конце строки выдает следующую ошибку

      WARNING:root:Failed to load sweep, skipping. ('Dataset' object has no attribute 'value')
Traceback (most recent call last):
  File "/Users/vittoriodefalco/Desktop/GLIF/prova.py", line 64, in <module>
    simulate_neuron(neuron, sweep_numbers, ephys_file_name, ephys_file_name, 0.05)
  File "/usr/local/lib/python3.9/site-packages/allensdk/model/glif/simulate_neuron.py", line 131, in simulate_neuron
    simulate_sweep_from_file(neuron, sweep_number, input_file_name, output_file_name, spike_cut_value)
  File "/usr/local/lib/python3.9/site-packages/allensdk/model/glif/simulate_neuron.py", line 112, in simulate_sweep_from_file
    data = load_sweep(input_file_name, sweep_number)
  File "/usr/local/lib/python3.9/site-packages/allensdk/model/glif/simulate_neuron.py", line 85, in load_sweep
    data = NwbDataSet(file_name).get_sweep(sweep_number)
  File "/usr/local/lib/python3.9/site-packages/allensdk/core/nwb_data_set.py", line 108, in get_sweep
    stimulus = stimulus_dataset.value

Я установил Python (3.9.5) и h5py (3.1.0). Не могли бы вы помочь мне исправить эту ошибку?

0 ответов

Другие вопросы по тегам