def main(): assembly = collect_data() assembly.name = ASSEMBLY_NAME print('Packaging assembly') package_data_assembly(xarray.DataArray(assembly), assembly_identifier=assembly.name, stimulus_set_identifier=SPATIAL_FREQUENCY_STIM_NAME, assembly_class='PropertyAssembly', bucket_name='brainio.contrib')
def repackage_assemblies(): for identifier in assemblies.list_assemblies(): print(f"Repackaging {identifier}") assembly = brainio_collection.get_assembly(identifier) stimulus_set_identifier = assembly.stimulus_set_name # fix individual assemblies assembly_class = assembly.__class__.__name__ if identifier == 'dicarlo.Kar2019': # change OST assembly assembly_class = 'DataAssembly' # it's not actually a NeuronRecordingAssembly because it contains OSTs if identifier == 'klab.Zhang2018search_obj_array': assembly_class = 'BehavioralAssembly' # was incorrectly packaged as NeuronRecordingAssembly but is behavior if identifier.startswith('dicarlo.Majaj2015'): assembly.name = assembly.name.replace( 'Majaj2015', 'MajajHong2015') # joint first authors # strip assembly = _strip_presentation_coords(assembly) del assembly.attrs['stimulus_set'] del assembly.attrs['stimulus_set_name'] # re-assign bucket assembly_model = assemblies.lookup_assembly(identifier) store = assembly_model.assembly_store_maps[0] location = store.assembly_store_model.location bucket = 'brainio-dicarlo' if 'brainio-dicarlo' in location else 'brainio-contrib' bucket = bucket.replace('-', '.') # package package_data_assembly(assembly, assembly_identifier=assembly.name, stimulus_set_identifier=stimulus_set_identifier, assembly_class=assembly_class, bucket_name=bucket)
def main(): metric_bins_path = Path("/braintree/home/darren/work/metric_bins.npy") csv_path = Path( __file__).parents[2] / "notebooks" / "2020-11-22_hvm_from_dldata.csv" stimuli = brainio_collection.get_stimulus_set('dicarlo.hvm') assembly = load_responses(metric_bins_path, csv_path) assembly.name = 'dicarlo.Seibert2019' print('Packaging assembly') package_data_assembly(assembly, assembly_identifier=assembly.name, stimulus_set_identifier=stimuli.identifier, bucket_name='brainio.dicarlo')
def main(): data_dir = Path(__file__).parents[6] / 'data2' / 'active' / 'users' / 'sachis' assert os.path.isdir(data_dir) stimuli = collect_stimuli(data_dir) stimuli.identifier = 'dicarlo.THINGS2' assembly = load_responses(data_dir, stimuli) assembly.name = 'dicarlo.SanghaviMurty2020THINGS2' print('Packaging stimuli') package_stimulus_set(stimuli, stimulus_set_identifier=stimuli.identifier, bucket_name='brainio.dicarlo') print('Packaging assembly') package_data_assembly(assembly, assembly_identifier=assembly.name, stimulus_set_identifier=stimuli.identifier, bucket_name='brainio.dicarlo') return
def main(): data_dir = Path(__file__).parents[ 6] / 'data2' / 'active' / 'users' / 'sachis' / 'database' assert os.path.isdir(data_dir) stimuli = brainio_collection.get_stimulus_set('dicarlo.hvm') assembly = load_responses(data_dir, stimuli) assembly.name = 'dicarlo.Sanghavi2020' print('Packaging assembly') package_data_assembly(assembly, assembly_identifier=assembly.name, stimulus_set_identifier=stimuli.identifier, bucket_name='brainio.dicarlo') return
def main(): stimuli = collect_stimuli(storage_location) stimuli.name = 'aru.Kuzovkin2018' assembly = load_responses(storage_location, stimuli) assembly.name = 'aru.Kuzovkin2018' print("Packaging stimuli") package_stimulus_set(stimuli, stimulus_set_identifier=stimuli.name, bucket_name="brainio.contrib") print("Packaging assembly") package_data_assembly(assembly, assembly_identifier=assembly.name, stimulus_set_identifier=stimuli.name, bucket_name="brainio.contrib")
def main(): stimuli = brainio_collection.get_stimulus_set('dicarlo.Rust2012') single_nc_path = Path("/Users/jjpr/dev/dldata/scripts/rust_single.nc") da_single = xr.open_dataarray(single_nc_path) da_single.name = 'dicarlo.Rust2012.single' print('Packaging assembly for single-unit') package_data_assembly(da_single, assembly_identifier=da_single.name, stimulus_set_identifier=stimuli.identifier, bucket_name='brainio.dicarlo') array_nc_path = Path("/Users/jjpr/dev/dldata/scripts/rust_array.nc") da_array = xr.open_dataarray(array_nc_path) da_array.name = 'dicarlo.Rust2012.array' print('Packaging assembly for array') package_data_assembly(da_array, assembly_identifier=da_array.name, stimulus_set_identifier=stimuli.identifier, bucket_name='brainio.dicarlo')
def main(): data_dir = Path( "/Users/jjpr/dev/brainio_contrib/mkgu_packaging/dicarlo/BashivanKar2019" ) assert os.path.isdir(data_dir) h5_path = data_dir / "from_pouya" / "npc_v4_data.h5" h5 = tables.open_file(h5_path) stimuli_nat = collect_stimuli_nat(h5, data_dir) stimuli_nat.identifier = "dicarlo.BashivanKar2019.naturalistic" responses_nat_d = collect_responses_nat(h5, stimuli_nat) stimuli_synth, responses_synth_d = collect_synth(h5, data_dir) stimuli_synth.identifier = "dicarlo.BashivanKar2019.synthetic" _logger.debug('Packaging naturalistic stimuli') package_stimulus_set(stimuli_nat, stimulus_set_identifier=stimuli_nat.identifier, bucket_name='brainio.dicarlo') _logger.debug('Packaging naturalistic assembly') responses_nat_concat = xr.concat(responses_nat_d.values(), dim="neuroid") assert responses_nat_concat.shape == (24320, 233, 1) package_data_assembly( responses_nat_concat, assembly_identifier="dicarlo.BashivanKar2019.naturalistic", stimulus_set_identifier=stimuli_nat.identifier, bucket_name='brainio.dicarlo') _logger.debug('Packaging synthetic stimuli') package_stimulus_set(stimuli_synth, stimulus_set_identifier=stimuli_synth.identifier, bucket_name='brainio.dicarlo') _logger.debug('Packaging synthetic assembly') responses_synth_concat = xr.concat(responses_synth_d.values(), dim="presentation") assert responses_synth_concat.shape == (21360, 233, 1) package_data_assembly( responses_synth_concat, assembly_identifier="dicarlo.BashivanKar2019.synthetic", stimulus_set_identifier=stimuli_synth.identifier, bucket_name='brainio.dicarlo')
assembly = xr.DataArray(rdm_response, coords={ 'presentation': pres_coord, 'presentation': pres_coord, "image_id": ('presentation', pres_coord), 'subject': list(range(rdm_response.shape[2])), }, dims=['presentation', 'presentation', 'subject']) assembly = DataAssembly(assembly) #assembly = assembly.transpose('presentation', 'presentation', 'subject') return assembly if __name__ == "__main__": stimuli = collect_stimuli(storage_location) stimuli.name = 'aru.Cichy2019' assembly = load_responses(storage_location + "RDM.npy", stimuli) assembly.name = 'aru.Cichy2019' print("Packaging stimuli") package_stimulus_set(stimuli, stimulus_set_identifier=stimuli.name, bucket_name="brainio.contrib") print("Packaging assembly") package_data_assembly(assembly, assembly_identifier=assembly.name, stimulus_set_identifier=stimuli.name, bucket_name="brainio.contrib", assembly_class="DataAssembly")