Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

V1 properties data assemblies and stimulus sets #33

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Empty file.
82 changes: 82 additions & 0 deletions mkgu_packaging/dicarlo/marques/marques_cavanaugh2002a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

import numpy as np
from marques_utils import gen_sample
from brainio_collection.packaging import package_data_assembly
from brainio_base.assemblies import DataAssembly

ASSEMBLY_NAME = 'movshon.Cavanaugh2002a'
SIZE_STIM_NAME = 'dicarlo.Marques2020_size'

PROPERTY_NAMES = ['surround_suppression_index', 'strongly_suppressed', 'grating_summation_field', 'surround_diameter',
'surround_grating_summation_field_ratio']


def collect_data():
n_neurons = 190

# Surround suppression index (n=190 neurons, foveal eccentricity, response > 5spk/s)
surround_suppression_index_bins = np.linspace(0, 2, num=11)
surround_suppression_index_hist = np.array([66, 44, 38, 23, 16, 3, 0, 0, 0, 0])
surround_suppression_index = gen_sample(surround_suppression_index_hist, surround_suppression_index_bins,
scale='linear')

# Strongly suppressed (n=190 neurons, foveal eccentricity, response > 5spk/s)
strongly_suppressed_bins = np.linspace(0, 1, num=3)
strongly_suppressed_hist = np.array([42, 148])
strongly_suppressed = np.concatenate((np.zeros(strongly_suppressed_hist[0]),
np.ones(strongly_suppressed_hist[1]))).reshape((-1, 1))

# Grating summation field (n=148 neurons & suppression > 10%)
grating_summation_field_bins = np.array([0.0625, 0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0])
grating_summation_field_hist = np.array([0, 9, 30, 55, 42, 10, 2, 0])
grating_summation_field = gen_sample(grating_summation_field_hist, grating_summation_field_bins, scale='log2')
filler = np.zeros((n_neurons - grating_summation_field_hist.sum(), 1))
filler[:] = np.nan
grating_summation_field = np.concatenate((filler, grating_summation_field))

# Surround diameter (n=148 neurons & suppression > 10%)
surround_diameter_bins = np.array([0.0625, 0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0])
surround_diameter_hist = np.array([0, 0, 2, 20, 33, 49, 40, 4])
surround_diameter = gen_sample(surround_diameter_hist, surround_diameter_bins, scale='log2')
filler = np.zeros((n_neurons - surround_diameter_hist.sum(), 1))
filler[:] = np.nan
surround_diameter = np.concatenate((filler, surround_diameter))

# Surround diameter / Grating summation field (n=148 neurons, foveal eccentricity & suppression > 10%)
surround_grating_summation_field_ratio_bins = np.array([1, 2, 4, 8, 16, 32])
surround_grating_summation_field_ratio_hist = np.array([69, 38, 31, 10, 0])
surround_grating_summation_field_ratio = gen_sample(surround_grating_summation_field_ratio_hist,
surround_grating_summation_field_ratio_bins, scale='log2')
filler = np.zeros((n_neurons - surround_grating_summation_field_ratio_hist.sum(), 1))
filler[:] = np.nan
surround_grating_summation_field_ratio = np.concatenate((filler, surround_grating_summation_field_ratio))

# Create DataAssembly with single neuronal properties and bin information
assembly = np.concatenate((surround_suppression_index, strongly_suppressed, grating_summation_field,
surround_diameter, surround_grating_summation_field_ratio), axis=1)

assembly = DataAssembly(assembly, coords={'neuroid_id': ('neuroid', range(assembly.shape[0])),
'region': ('neuroid', ['V1'] * assembly.shape[0]),
'neuronal_property': PROPERTY_NAMES},
dims=['neuroid', 'neuronal_property'])

assembly.attrs['number_of_trials'] = 20

for p in assembly.coords['neuronal_property'].values:
assembly.attrs[p+'_bins'] = eval(p+'_bins')

return assembly


def main():
assembly = collect_data()
assembly.name = ASSEMBLY_NAME
print('Packaging assembly')
package_data_assembly(assembly, assembly_identifier=assembly.name,
stimulus_set_identifier=SIZE_STIM_NAME, assembly_class='PropertyAssembly',
bucket_name='brainio.contrib')


if __name__ == '__main__':
main()

43 changes: 43 additions & 0 deletions mkgu_packaging/dicarlo/marques/marques_devalois1982a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

import numpy as np
from marques_utils import gen_sample
from brainio_collection.packaging import package_data_assembly
from brainio_base.assemblies import DataAssembly

ASSEMBLY_NAME = 'devalois.DeValois1982a'
ORIENTATION_STIM_NAME = 'dicarlo.Marques2020_orientation'


def collect_data():
# Preferred orientation data
preferred_orientation_hist = np.array([110, 83, 100, 92])
preferred_orientation_bins = np.linspace(-22.5, 157.5, 5)

preferred_orientation = gen_sample(preferred_orientation_hist, preferred_orientation_bins, scale='linear')

# Create DataAssembly with single neuronal properties and bin information
assembly = DataAssembly(preferred_orientation, coords={'neuroid_id': ('neuroid',
range(preferred_orientation.shape[0])),
'region': ('neuroid', ['V1'] * preferred_orientation.shape[0]),
'neuronal_property': ['preferred_orientation']},
dims=['neuroid', 'neuronal_property'])

assembly.attrs['number_of_trials'] = 20

for p in assembly.coords['neuronal_property'].values:
assembly.attrs[p+'_bins'] = eval(p+'_bins')

return assembly


def main():
assembly = collect_data()
assembly.name = ASSEMBLY_NAME
print('Packaging assembly')
package_data_assembly(assembly, assembly_identifier=assembly.name, stimulus_set_identifier=ORIENTATION_STIM_NAME,
assembly_class='PropertyAssembly', bucket_name='brainio.contrib')


if __name__ == '__main__':
main()

58 changes: 58 additions & 0 deletions mkgu_packaging/dicarlo/marques/marques_devalois1982b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

import numpy as np
from marques_utils import gen_sample
from brainio_collection.packaging import package_data_assembly
from brainio_base.assemblies import DataAssembly

ASSEMBLY_NAME = 'devalois.DeValois1982b'
SPATIAL_FREQUENCY_STIM_NAME = 'dicarlo.Marques2020_spatial_frequency'


def collect_data():
# Peak spatial frequency data
peak_spatial_frequency_bins = np.array([0.35, 0.5, 0.7, 1.0, 1.4, 2.0, 2.8, 4.0, 5.6, 8.0, 11.2, 16.0, 22.4])
# peak_spatial_frequency_simple_hist = np.array([0, 4, 4, 8, 25, 33, 26, 28, 12, 5, 2, 1])
# peak_spatial_frequency_complex_hist = np.array([0, 0, 0, 9, 9, 7, 10, 23, 12, 8, 3, 3])
# peak_spatial_frequency_hist = (peak_spatial_frequency_simple_hist + peak_spatial_frequency_complex_hist)
#
# peak_spatial_frequency = gen_sample(peak_spatial_frequency_hist, peak_spatial_frequency_bins, scale='log2')

peak_spatial_frequency_simple_foveal_hist = np.array([0, 4, 4, 8, 25, 33, 26, 28, 12, 5, 2, 1])
peak_spatial_frequency_complex_foveal_hist = np.array([0, 0, 0, 9, 9, 7, 10, 23, 12, 8, 3, 3])
peak_spatial_frequency_simple_parafoveal_hist = np.array([2, 4, 10, 12, 18, 7, 18, 3, 4, 0, 0, 0])
peak_spatial_frequency_complex_parafoveal_hist = np.array([1, 2, 1, 2, 5, 15, 13, 9, 3, 2, 0, 0])

peak_spatial_frequency_hist = (
peak_spatial_frequency_simple_foveal_hist + peak_spatial_frequency_complex_foveal_hist +
peak_spatial_frequency_simple_parafoveal_hist + peak_spatial_frequency_complex_parafoveal_hist)

peak_spatial_frequency = gen_sample(peak_spatial_frequency_hist, peak_spatial_frequency_bins, scale='log2')

# Create DataAssembly with single neuronal properties and bin information
assembly = DataAssembly(peak_spatial_frequency, coords={'neuroid_id': ('neuroid',
range(peak_spatial_frequency.shape[0])),
'region': ('neuroid', ['V1'] *
peak_spatial_frequency.shape[0]),
'neuronal_property': ['peak_spatial_frequency']},
dims=['neuroid', 'neuronal_property'])

assembly.attrs['number_of_trials'] = 20

for p in assembly.coords['neuronal_property'].values:
assembly.attrs[p+'_bins'] = eval(p+'_bins')

return assembly


def main():
assembly = collect_data()
assembly.name = ASSEMBLY_NAME
print('Packaging assembly')
package_data_assembly(assembly, assembly_identifier=assembly.name,
stimulus_set_identifier=SPATIAL_FREQUENCY_STIM_NAME, assembly_class='PropertyAssembly',
bucket_name='brainio.contrib')


if __name__ == '__main__':
main()

Loading