From cc532e69da1c22b92c535d3c296846d44205eef3 Mon Sep 17 00:00:00 2001 From: Jenkins Date: Mon, 28 Oct 2024 11:56:15 -0500 Subject: [PATCH] add DataGenerationTrial_emogan to data --- .../DataGenerationTrial_emogan/__init__.py | 25 +++++++++++++++++++ .../data_packaging.py | 19 ++++++++++++++ .../data/DataGenerationTrial_emogan/test.py | 23 +++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 brainscore_vision/data/DataGenerationTrial_emogan/__init__.py create mode 100644 brainscore_vision/data/DataGenerationTrial_emogan/data_packaging.py create mode 100644 brainscore_vision/data/DataGenerationTrial_emogan/test.py diff --git a/brainscore_vision/data/DataGenerationTrial_emogan/__init__.py b/brainscore_vision/data/DataGenerationTrial_emogan/__init__.py new file mode 100644 index 000000000..1aa4c6a03 --- /dev/null +++ b/brainscore_vision/data/DataGenerationTrial_emogan/__init__.py @@ -0,0 +1,25 @@ +from brainio.assemblies import NeuronRecordingAssembly +from brainscore_vision import load_stimulus_set +from brainscore_vision import stimulus_set_registry, data_registry +from brainscore_vision.data_helpers.s3 import load_assembly_from_s3, load_stimulus_set_from_s3 + +stimulus_set_registry["DataGenerationTrial_emogan"] = lambda: load_stimulus_set_from_s3( + identifier="DataGenerationTrial_emogan", + bucket="brainio-brainscore", + csv_version_id="eSkkdLTpUBKFdag.Xz_6Uq_HUo3CiN8c", + csv_sha1="087229269f5cfc9018009b8020065567ee366b54", + zip_version_id="eof2xRz5l9IEmnnjmBT2VH1Y1ruShiDJ", + zip_sha1="530b472fa9dd2008a8911364b1725df56f8c45bc", + filename_prefix='stimulus_', +) + +data_registry["DataGenerationTrial_emogan"] = lambda: load_assembly_from_s3( + identifier="DataGenerationTrial_emogan", + version_id="_mJCWVxrROgzjRSlkH7kFgKW0PmvLbwx", + sha1="0337d87832a0b38960a909fc53188a9f93e1b459", + bucket="brainio-brainscore", + cls=NeuronRecordingAssembly, + stimulus_set_loader=lambda: load_stimulus_set('DataGenerationTrial_emogan'), +) + + \ No newline at end of file diff --git a/brainscore_vision/data/DataGenerationTrial_emogan/data_packaging.py b/brainscore_vision/data/DataGenerationTrial_emogan/data_packaging.py new file mode 100644 index 000000000..74b42cfe2 --- /dev/null +++ b/brainscore_vision/data/DataGenerationTrial_emogan/data_packaging.py @@ -0,0 +1,19 @@ +from brainio.packaging import package_stimulus_set, package_data_assembly +from brainscore_vision import load_dataset, load_stimulus_set + +def upload_stimulus_set_to_s3(stimuli): + return package_stimulus_set(catalog_name=None, proto_stimulus_set=stimuli, + stimulus_set_identifier=stimuli.name, bucket_name="brainio-brainscore") + +def upload_assembly_to_s3(assembly): + return package_data_assembly(None, assembly, assembly_identifier=assembly.name, + stimulus_set_identifier=assembly.name, + assembly_class_name="NeuronRecordingAssembly", + bucket_name="brainio-brainscore") + + +if __name__ == '__main__': + ss = load_stimulus_set('DataGenerationTrial_emogan') + assembly = load_dataset('DataGenerationTrial_emogan') + + \ No newline at end of file diff --git a/brainscore_vision/data/DataGenerationTrial_emogan/test.py b/brainscore_vision/data/DataGenerationTrial_emogan/test.py new file mode 100644 index 000000000..bb4de5626 --- /dev/null +++ b/brainscore_vision/data/DataGenerationTrial_emogan/test.py @@ -0,0 +1,23 @@ +import pytest + +from brainscore_vision import load_dataset, load_stimulus_set +from brainscore_vision.benchmark_helpers import check_standard_format + + +@pytest.mark.memory_intense +@pytest.mark.private_access +def test_assembly(): + assembly = load_dataset('DataGenerationTrial_emogan') + check_standard_format(assembly, nans_expected=True) + assert assembly.attrs['stimulus_set_identifier'] == 'DataGenerationTrial_emogan' + assert set(assembly['region'].values) == {'IT'} + assert len(assembly['presentation']) == 8500 + assert len(assembly['neuroid']) == 18 + + +@pytest.mark.private_access +def test_stimulus_set(): + stimulus_set = load_stimulus_set('DataGenerationTrial_emogan') + assert len(stimulus_set) == 170 + + \ No newline at end of file