diff --git a/mpesparser/__init__.py b/mpesparser/__init__.py index 83158d70ddb0abc3c514b07c618a258f9ccff6ef..bc13691615f5e144992be216925382e6ef6009f6 100644 --- a/mpesparser/__init__.py +++ b/mpesparser/__init__.py @@ -59,10 +59,7 @@ class MPESParser(AbstractBaseParser): with open(filepath, 'rt') as f: data = json.load(f) # print(data) - - # # You need to open sections before you can add values or sub sections to it. - # # The returned 'gid' can be used to reference a specific section if multiple - # # sections of the same type are opened. + root_gid = backend.openSection('section_experiment') # # Values do not necessarely have to be read from the parsed file. # # The backend will check the type of the given value agains the metadata definition. @@ -70,8 +67,8 @@ class MPESParser(AbstractBaseParser): # # # Read data . # data_gid = backend.openSection('section_data') - # backend.addValue('data_repository_name', 'zenodo.org') - # backend.addValue('data_repository_url', 'https://zenodo.org/path/to/mydata') + backend.addValue('data_repository_name', data.get('data_repository_name')) + backend.addValue('data_repository_url', data.get('data_repository_url')) # backend.addValue('data_preview_url', 'https://www.physicsforums.com/insights/wp-content/uploads/2015/09/fem.jpg') # backend.closeSection('section_data', data_gid) @@ -162,11 +159,6 @@ class MPESParser(AbstractBaseParser): backend.addValue('sample_substrate_state_of_matter', data.get('substrate_state')) backend.addValue('sample_substrate_vendor', data.get('substrate_vendor')) - # To add arrays (vectors, matrices, etc.) use addArrayValues and provide a - # numpy array. The shape of the numpy array must match the shape defined in - # the respective metadata definition. - - # Close sections in the reverse order # backend.closeSection('section_data', data_gid) backend.closeSection('section_experiment', root_gid) diff --git a/tests/mpes.metadata_redacted.json b/tests/mpes.metadata_redacted.json index 299d3011a68f7873638f1c017b9f755a809c92c3..40ec54c61bf9bbc7d96d4eb1d9820e26184d3dc4 100644 --- a/tests/mpes.metadata_redacted.json +++ b/tests/mpes.metadata_redacted.json @@ -1,4 +1,6 @@ { + "data_repository_name": "zenodo.org", + "data_repository_url": "https://zenodo.org/deposit/2704788", "experiment_method": "multidimensional photoemission spectroscopy", "experiment_method_abbrv": "MPES", "experiment_location": "Hamburg, Germany",