diff --git a/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_LOAD_DATA-checkpoint.py b/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_LOAD_DATA-checkpoint.py index 7e32bac7ece0e1f4c06ee4f0bdec608e25736171..241c3256b704867be05179a45f2ee381dff11c55 100644 --- a/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_LOAD_DATA-checkpoint.py +++ b/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_LOAD_DATA-checkpoint.py @@ -4,34 +4,7 @@ import matplotlib.pyplot as plt from multiarea_model import Analysis -def load_and_create_data(M): - """ - Analysis class. - An instance of the analysis class for the given network and simulation. - Can be created as a member class of a multiarea_model instance or standalone. - - Parameters - ---------- - network : MultiAreaModel - An instance of the multiarea_model class that specifies - the network to be analyzed. - simulation : Simulation - An instance of the simulation class that specifies - the simulation to be analyzed. - data_list : list of strings {'spikes', vm'}, optional - Specifies which type of data is to load. Defaults to ['spikes']. - load_areas : list of strings with area names, optional - Specifies the areas for which data is to be loaded. - Default value is None and leads to loading of data for all - simulated areas. - """ - # Instantiate an analysis class and load spike data - # A = Analysis(network=M, - # simulation=M.simulation, - # data_list=['spikes'], - # load_areas=None) - - +def load_and_create_data(M, A): """ Calculate time-averaged population rates and store them in member pop_rates. If the rates had previously been stored with the same @@ -57,8 +30,8 @@ def load_and_create_data(M): If set to 'complete', all populations the respective areas are included. Defaults to 'complete'. """ - # A.create_pop_rates() - subprocess.run(['python3', './figures/Schmidt2018_dyn/compute_pop_rates.py']) + A.create_pop_rates() + # subprocess.run(['python3', './figures/Schmidt2018_dyn/compute_pop_rates.py']) # subprocess.run(['Rscript', '--vanilla', 'compute_bold_signal.R', fn, out_fn]) print("Computing population rates done") @@ -83,7 +56,7 @@ def load_and_create_data(M): If set to 'complete', all populations the respective areas are included. Defaults to 'complete'. """ - # A.create_pop_LvR() + A.create_pop_LvR() print("Computing population LvR done") @@ -119,55 +92,55 @@ def load_and_create_data(M): - 'alpha_time_window' : time constant of the alpha function - 'rect_time_window' : width of the moving rectangular function """ - # A.create_rate_time_series() + A.create_rate_time_series() print("Computing rate time series done") -# """ -# Calculate synaptic input of populations and areas using the spike data. -# Uses function ah.pop_synaptic_input. -# If the synaptic inputs have previously been stored with the -# same parameters, they are loaded from file. + """ + Calculate synaptic input of populations and areas using the spike data. + Uses function ah.pop_synaptic_input. + If the synaptic inputs have previously been stored with the + same parameters, they are loaded from file. -# Parameters -# ---------- -# t_min : float, optional -# Minimal time in ms of the simulation to take into account -# for the calculation. Defaults to 500 ms. -# t_max : float, optional -# Maximal time in ms of the simulation to take into account -# for the calculation. Defaults to the simulation time. -# areas : list, optional -# Which areas to include in the calculcation. -# Defaults to all loaded areas. -# pops : list or {'complete'}, optional -# Which populations to include in the calculation. -# If set to 'complete', all populations the respective areas -# are included. Defaults to 'complete'. -# kernel : {'gauss_time_window', 'alpha_time_window', 'rect_time_window'}, optional -# Convolution kernel for the calculation of the underlying firing rates. -# Defaults to 'binned' which corresponds to a simple histogram. -# resolution: float, optional -# Width of the convolution kernel. Specifically it correponds to: -# - 'binned' : bin width of the histogram -# - 'gauss_time_window' : sigma -# - 'alpha_time_window' : time constant of the alpha function -# - 'rect_time_window' : width of the moving rectangular function -# """ -# A.create_synaptic_input() -# print("Computing synaptic input done") + Parameters + ---------- + t_min : float, optional + Minimal time in ms of the simulation to take into account + for the calculation. Defaults to 500 ms. + t_max : float, optional + Maximal time in ms of the simulation to take into account + for the calculation. Defaults to the simulation time. + areas : list, optional + Which areas to include in the calculcation. + Defaults to all loaded areas. + pops : list or {'complete'}, optional + Which populations to include in the calculation. + If set to 'complete', all populations the respective areas + are included. Defaults to 'complete'. + kernel : {'gauss_time_window', 'alpha_time_window', 'rect_time_window'}, optional + Convolution kernel for the calculation of the underlying firing rates. + Defaults to 'binned' which corresponds to a simple histogram. + resolution: float, optional + Width of the convolution kernel. Specifically it correponds to: + - 'binned' : bin width of the histogram + - 'gauss_time_window' : sigma + - 'alpha_time_window' : time constant of the alpha function + - 'rect_time_window' : width of the moving rectangular function + """ + A.create_synaptic_input() + print("Computing synaptic input done") - # A.save() + A.save() - # """ - # Compute BOLD signal for a given area from the time series of - # population-averaged spike rates of a given simulation using the - # neuRosim package of R (see Schmidt et al. 2018 for more details). - # """ - # try: - # subprocess.run(['python3', './../Schmidt2018_dyn/compute_bold_signal.py']) - # # subprocess.run(['Rscript', '--vanilla', 'compute_bold_signal.R', fn, out_fn]) - # except FileNotFoundError: - # raise FileNotFoundError("Executing R failed. Did you install R?") + """ + Compute BOLD signal for a given area from the time series of + population-averaged spike rates of a given simulation using the + neuRosim package of R (see Schmidt et al. 2018 for more details). + """ + try: + subprocess.run(['python3', './Schmidt2018_dyn/compute_bold_signal.py']) + # subprocess.run(['Rscript', '--vanilla', 'compute_bold_signal.R', fn, out_fn]) + except FileNotFoundError: + raise FileNotFoundError("Executing R failed. Did you install R?") - # return A \ No newline at end of file + return A \ No newline at end of file diff --git a/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_visualize_resting_state-checkpoint.py b/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_visualize_resting_state-checkpoint.py index d1970f682c8e4fb7047b9f024c37ba18ce27a018..d6da1ef94e4a74805a035f295948b82230a456b4 100644 --- a/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_visualize_resting_state-checkpoint.py +++ b/figures/MAM2EBRAINS/.ipynb_checkpoints/M2E_visualize_resting_state-checkpoint.py @@ -35,8 +35,34 @@ def set_boxplot_props(d): markerfacecolor='k', markeredgecolor='k', markersize=3.) def plot_resting_state(M, data_path): + """ + Analysis class. + An instance of the analysis class for the given network and simulation. + Can be created as a member class of a multiarea_model instance or standalone. + + Parameters + ---------- + network : MultiAreaModel + An instance of the multiarea_model class that specifies + the network to be analyzed. + simulation : Simulation + An instance of the simulation class that specifies + the simulation to be analyzed. + data_list : list of strings {'spikes', vm'}, optional + Specifies which type of data is to load. Defaults to ['spikes']. + load_areas : list of strings with area names, optional + Specifies the areas for which data is to be loaded. + Default value is None and leads to loading of data for all + simulated areas. + """ + # Instantiate an analysis class and load spike data + A = Analysis(network=M, + simulation=M.simulation, + data_list=['spikes'], + load_areas=None) + # load data - A = load_and_create_data(M) + load_and_create_data(M, A) label_spikes = M.simulation.label label = M.simulation.label @@ -154,16 +180,16 @@ def plot_resting_state(M, data_path): # M = MultiAreaModel({}) # spike data - spike_data = {} - for area in areas: - spike_data[area] = {} - for pop in M.structure[area]: - spike_data[area][pop] = np.load(os.path.join(data_path, - label_spikes, - 'recordings', - '{}-spikes-{}-{}.npy'.format(label_spikes, - area, pop))) - # spike_data = A.spike_data + # spike_data = {} + # for area in areas: + # spike_data[area] = {} + # for pop in M.structure[area]: + # spike_data[area][pop] = np.load(os.path.join(data_path, + # label_spikes, + # 'recordings', + # '{}-spikes-{}-{}.npy'.format(label_spikes, + # area, pop))) + spike_data = A.spike_data # stationary firing rates fn = os.path.join(data_path, label, 'Analysis', 'pop_rates.json') diff --git a/figures/MAM2EBRAINS/M2E_LOAD_DATA.py b/figures/MAM2EBRAINS/M2E_LOAD_DATA.py index 7e32bac7ece0e1f4c06ee4f0bdec608e25736171..241c3256b704867be05179a45f2ee381dff11c55 100644 --- a/figures/MAM2EBRAINS/M2E_LOAD_DATA.py +++ b/figures/MAM2EBRAINS/M2E_LOAD_DATA.py @@ -4,34 +4,7 @@ import matplotlib.pyplot as plt from multiarea_model import Analysis -def load_and_create_data(M): - """ - Analysis class. - An instance of the analysis class for the given network and simulation. - Can be created as a member class of a multiarea_model instance or standalone. - - Parameters - ---------- - network : MultiAreaModel - An instance of the multiarea_model class that specifies - the network to be analyzed. - simulation : Simulation - An instance of the simulation class that specifies - the simulation to be analyzed. - data_list : list of strings {'spikes', vm'}, optional - Specifies which type of data is to load. Defaults to ['spikes']. - load_areas : list of strings with area names, optional - Specifies the areas for which data is to be loaded. - Default value is None and leads to loading of data for all - simulated areas. - """ - # Instantiate an analysis class and load spike data - # A = Analysis(network=M, - # simulation=M.simulation, - # data_list=['spikes'], - # load_areas=None) - - +def load_and_create_data(M, A): """ Calculate time-averaged population rates and store them in member pop_rates. If the rates had previously been stored with the same @@ -57,8 +30,8 @@ def load_and_create_data(M): If set to 'complete', all populations the respective areas are included. Defaults to 'complete'. """ - # A.create_pop_rates() - subprocess.run(['python3', './figures/Schmidt2018_dyn/compute_pop_rates.py']) + A.create_pop_rates() + # subprocess.run(['python3', './figures/Schmidt2018_dyn/compute_pop_rates.py']) # subprocess.run(['Rscript', '--vanilla', 'compute_bold_signal.R', fn, out_fn]) print("Computing population rates done") @@ -83,7 +56,7 @@ def load_and_create_data(M): If set to 'complete', all populations the respective areas are included. Defaults to 'complete'. """ - # A.create_pop_LvR() + A.create_pop_LvR() print("Computing population LvR done") @@ -119,55 +92,55 @@ def load_and_create_data(M): - 'alpha_time_window' : time constant of the alpha function - 'rect_time_window' : width of the moving rectangular function """ - # A.create_rate_time_series() + A.create_rate_time_series() print("Computing rate time series done") -# """ -# Calculate synaptic input of populations and areas using the spike data. -# Uses function ah.pop_synaptic_input. -# If the synaptic inputs have previously been stored with the -# same parameters, they are loaded from file. + """ + Calculate synaptic input of populations and areas using the spike data. + Uses function ah.pop_synaptic_input. + If the synaptic inputs have previously been stored with the + same parameters, they are loaded from file. -# Parameters -# ---------- -# t_min : float, optional -# Minimal time in ms of the simulation to take into account -# for the calculation. Defaults to 500 ms. -# t_max : float, optional -# Maximal time in ms of the simulation to take into account -# for the calculation. Defaults to the simulation time. -# areas : list, optional -# Which areas to include in the calculcation. -# Defaults to all loaded areas. -# pops : list or {'complete'}, optional -# Which populations to include in the calculation. -# If set to 'complete', all populations the respective areas -# are included. Defaults to 'complete'. -# kernel : {'gauss_time_window', 'alpha_time_window', 'rect_time_window'}, optional -# Convolution kernel for the calculation of the underlying firing rates. -# Defaults to 'binned' which corresponds to a simple histogram. -# resolution: float, optional -# Width of the convolution kernel. Specifically it correponds to: -# - 'binned' : bin width of the histogram -# - 'gauss_time_window' : sigma -# - 'alpha_time_window' : time constant of the alpha function -# - 'rect_time_window' : width of the moving rectangular function -# """ -# A.create_synaptic_input() -# print("Computing synaptic input done") + Parameters + ---------- + t_min : float, optional + Minimal time in ms of the simulation to take into account + for the calculation. Defaults to 500 ms. + t_max : float, optional + Maximal time in ms of the simulation to take into account + for the calculation. Defaults to the simulation time. + areas : list, optional + Which areas to include in the calculcation. + Defaults to all loaded areas. + pops : list or {'complete'}, optional + Which populations to include in the calculation. + If set to 'complete', all populations the respective areas + are included. Defaults to 'complete'. + kernel : {'gauss_time_window', 'alpha_time_window', 'rect_time_window'}, optional + Convolution kernel for the calculation of the underlying firing rates. + Defaults to 'binned' which corresponds to a simple histogram. + resolution: float, optional + Width of the convolution kernel. Specifically it correponds to: + - 'binned' : bin width of the histogram + - 'gauss_time_window' : sigma + - 'alpha_time_window' : time constant of the alpha function + - 'rect_time_window' : width of the moving rectangular function + """ + A.create_synaptic_input() + print("Computing synaptic input done") - # A.save() + A.save() - # """ - # Compute BOLD signal for a given area from the time series of - # population-averaged spike rates of a given simulation using the - # neuRosim package of R (see Schmidt et al. 2018 for more details). - # """ - # try: - # subprocess.run(['python3', './../Schmidt2018_dyn/compute_bold_signal.py']) - # # subprocess.run(['Rscript', '--vanilla', 'compute_bold_signal.R', fn, out_fn]) - # except FileNotFoundError: - # raise FileNotFoundError("Executing R failed. Did you install R?") + """ + Compute BOLD signal for a given area from the time series of + population-averaged spike rates of a given simulation using the + neuRosim package of R (see Schmidt et al. 2018 for more details). + """ + try: + subprocess.run(['python3', './Schmidt2018_dyn/compute_bold_signal.py']) + # subprocess.run(['Rscript', '--vanilla', 'compute_bold_signal.R', fn, out_fn]) + except FileNotFoundError: + raise FileNotFoundError("Executing R failed. Did you install R?") - # return A \ No newline at end of file + return A \ No newline at end of file diff --git a/figures/MAM2EBRAINS/M2E_visualize_resting_state.py b/figures/MAM2EBRAINS/M2E_visualize_resting_state.py index d1970f682c8e4fb7047b9f024c37ba18ce27a018..d6da1ef94e4a74805a035f295948b82230a456b4 100644 --- a/figures/MAM2EBRAINS/M2E_visualize_resting_state.py +++ b/figures/MAM2EBRAINS/M2E_visualize_resting_state.py @@ -35,8 +35,34 @@ def set_boxplot_props(d): markerfacecolor='k', markeredgecolor='k', markersize=3.) def plot_resting_state(M, data_path): + """ + Analysis class. + An instance of the analysis class for the given network and simulation. + Can be created as a member class of a multiarea_model instance or standalone. + + Parameters + ---------- + network : MultiAreaModel + An instance of the multiarea_model class that specifies + the network to be analyzed. + simulation : Simulation + An instance of the simulation class that specifies + the simulation to be analyzed. + data_list : list of strings {'spikes', vm'}, optional + Specifies which type of data is to load. Defaults to ['spikes']. + load_areas : list of strings with area names, optional + Specifies the areas for which data is to be loaded. + Default value is None and leads to loading of data for all + simulated areas. + """ + # Instantiate an analysis class and load spike data + A = Analysis(network=M, + simulation=M.simulation, + data_list=['spikes'], + load_areas=None) + # load data - A = load_and_create_data(M) + load_and_create_data(M, A) label_spikes = M.simulation.label label = M.simulation.label @@ -154,16 +180,16 @@ def plot_resting_state(M, data_path): # M = MultiAreaModel({}) # spike data - spike_data = {} - for area in areas: - spike_data[area] = {} - for pop in M.structure[area]: - spike_data[area][pop] = np.load(os.path.join(data_path, - label_spikes, - 'recordings', - '{}-spikes-{}-{}.npy'.format(label_spikes, - area, pop))) - # spike_data = A.spike_data + # spike_data = {} + # for area in areas: + # spike_data[area] = {} + # for pop in M.structure[area]: + # spike_data[area][pop] = np.load(os.path.join(data_path, + # label_spikes, + # 'recordings', + # '{}-spikes-{}-{}.npy'.format(label_spikes, + # area, pop))) + spike_data = A.spike_data # stationary firing rates fn = os.path.join(data_path, label, 'Analysis', 'pop_rates.json') diff --git a/multi-area-model.ipynb b/multi-area-model.ipynb index f9c882e161bcf23f2fd5e3c001ddee158735a87f..ba9073d59d189e9ff3458ef0496241a4fe4cb079 100644 --- a/multi-area-model.ipynb +++ b/multi-area-model.ipynb @@ -570,7 +570,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 18, "id": "ae19bcc3", "metadata": { "tags": [] @@ -583,7 +583,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn [16], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mM2E_visualize_resting_state\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m plot_resting_state\n\u001b[0;32m----> 2\u001b[0m plot_resting_state(M, data_path)\n", + "Cell \u001b[0;32mIn [18], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mM2E_visualize_resting_state\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m plot_resting_state\n\u001b[0;32m----> 2\u001b[0m plot_resting_state(M, data_path)\n", "File \u001b[0;32m~/MAM2EBRAINS/./figures/MAM2EBRAINS/M2E_visualize_resting_state.py:161\u001b[0m, in \u001b[0;36mplot_resting_state\u001b[0;34m(M, data_path)\u001b[0m\n\u001b[1;32m 159\u001b[0m spike_data[area] \u001b[38;5;241m=\u001b[39m {}\n\u001b[1;32m 160\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m pop \u001b[38;5;129;01min\u001b[39;00m M\u001b[38;5;241m.\u001b[39mstructure[area]:\n\u001b[0;32m--> 161\u001b[0m spike_data[area][pop] \u001b[38;5;241m=\u001b[39m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload\u001b[49m\u001b[43m(\u001b[49m\u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mjoin\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 162\u001b[0m \u001b[43m \u001b[49m\u001b[43mlabel_spikes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 163\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mrecordings\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 164\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;132;43;01m{}\u001b[39;49;00m\u001b[38;5;124;43m-spikes-\u001b[39;49m\u001b[38;5;132;43;01m{}\u001b[39;49;00m\u001b[38;5;124;43m-\u001b[39;49m\u001b[38;5;132;43;01m{}\u001b[39;49;00m\u001b[38;5;124;43m.npy\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mformat\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlabel_spikes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 165\u001b[0m \u001b[43m \u001b[49m\u001b[43marea\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpop\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 166\u001b[0m \u001b[38;5;66;03m# spike_data = A.spike_data\u001b[39;00m\n\u001b[1;32m 167\u001b[0m \n\u001b[1;32m 168\u001b[0m \u001b[38;5;66;03m# stationary firing rates\u001b[39;00m\n\u001b[1;32m 169\u001b[0m fn \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(data_path, label, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mAnalysis\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpop_rates.json\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", "File \u001b[0;32m/srv/main-spack-instance-2305/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.22.4-2oqgru7t5upcffz4fffhepvquuy3hdsh/lib/python3.8/site-packages/numpy/lib/npyio.py:430\u001b[0m, in \u001b[0;36mload\u001b[0;34m(file, mmap_mode, allow_pickle, fix_imports, encoding)\u001b[0m\n\u001b[1;32m 428\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mformat\u001b[39m\u001b[38;5;241m.\u001b[39mopen_memmap(file, mode\u001b[38;5;241m=\u001b[39mmmap_mode)\n\u001b[1;32m 429\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 430\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mformat\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_array\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfid\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mallow_pickle\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mallow_pickle\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 431\u001b[0m \u001b[43m \u001b[49m\u001b[43mpickle_kwargs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpickle_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 432\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 433\u001b[0m \u001b[38;5;66;03m# Try a pickle\u001b[39;00m\n\u001b[1;32m 434\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m allow_pickle:\n", "File \u001b[0;32m/srv/main-spack-instance-2305/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.22.4-2oqgru7t5upcffz4fffhepvquuy3hdsh/lib/python3.8/site-packages/numpy/lib/format.py:742\u001b[0m, in \u001b[0;36mread_array\u001b[0;34m(fp, allow_pickle, pickle_kwargs)\u001b[0m\n\u001b[1;32m 739\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m dtype\u001b[38;5;241m.\u001b[39mhasobject:\n\u001b[1;32m 740\u001b[0m \u001b[38;5;66;03m# The array contained Python objects. We need to unpickle the data.\u001b[39;00m\n\u001b[1;32m 741\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m allow_pickle:\n\u001b[0;32m--> 742\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mObject arrays cannot be loaded when \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 743\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_pickle=False\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 744\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m pickle_kwargs \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 745\u001b[0m pickle_kwargs \u001b[38;5;241m=\u001b[39m {}\n",