Commits (4)
......@@ -60,35 +60,40 @@ class MPESParser(AbstractBaseParser):
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.
# backend.addValue('experiment_time', int(datetime.strptime(data.get('date'), '%d.%M.%Y').timestamp()))
#
# # 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_preview_url', 'https://www.physicsforums.com/insights/wp-content/uploads/2015/09/fem.jpg')
# backend.closeSection('section_data', data_gid)
method_gid = backend.openSection('section_method')
# Read general experimental parameters
# general_gid = backend.openSection('section_experiment_general_parameters')
backend.addValue('general_experiment_method', data.get('experiment_method'))
backend.addValue('general_experiment_method_abbreviation', data.get('experiment_method_abbrv'))
backend.addArrayValues('general_experiment_location', np.array(re.findall(r"[\w']+", data.get('experiment_location'))))
backend.addValue('general_experiment_date', data.get('experiment_date'))
backend.addValue('general_experiment_summary', data.get('experiment_summary'))
backend.addValue('general_experiment_facility_institution', data.get('facility_institution'))
backend.addValue('general_experiment_facility_name', data.get('facility_name'))
backend.addValue('experiment_location', ', '.join(reversed(re.findall(r"[\w']+", data.get('experiment_location')))))
start, end = data.get('experiment_date').split(' ')
try:
backend.addValue('experiment_time', int(datetime.strptime(start, '%m.%Y').timestamp()))
except ValueError:
pass
try:
backend.addValue('experiment_end_time', int(datetime.strptime(end, '%m.%Y').timestamp()))
except ValueError:
pass
backend.addValue('experiment_summary', data.get('experiment_summary'))
backend.addValue('experiment_facility_institution', data.get('facility_institution'))
backend.addValue('experiment_facility_name', data.get('facility_name'))
# Read data parameters
data_gid = backend.openSection('section_data')
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', 'preview.png')
backend.closeSection('section_data', data_gid)
# Read method parameters
backend.addValue('experiment_method_name', data.get('experiment_method'))
backend.addValue('experiment_method_abbreviation', data.get('experiment_method_abbrv'))
backend.addValue('equipment_description', data.get('equipment_description'))
backend.addValue('probing_method', 'laser pulses')
backend.addValue('general_beamline', data.get('beamline'))
backend.addValue('general_source_pump', data.get('source_pump'))
backend.addValue('general_source_probe', data.get('source_probe'))
backend.addValue('general_equipment_description', data.get('equipment_description'))
backend.addValue('general_sample_description', data.get('sample_description'))
backend.addArrayValues('general_measurement_axis', np.array(re.findall(r"[\w']+", data.get('measurement_axis'))))
backend.addArrayValues('general_physical_axis', np.array(re.findall(r"[\w']+", data.get('physical_axis'))))
......@@ -138,8 +143,11 @@ class MPESParser(AbstractBaseParser):
backend.addArrayValues('detector_spatial_resolution', np.array(data.get('spatial_resolution')))
backend.addArrayValues('detector_energy_resolution', np.array(data.get('energy_resolution')))
backend.closeSection('section_method', method_gid)
# Read parameters related to sample
# sample_gid = backend.openSection('section_experiment_sample_parameters')
sample_gid = backend.openSection('section_sample')
backend.addValue('sample_description', data.get('sample_description'))
backend.addValue('sample_id', data.get('sample_id'))
backend.addValue('sample_state_of_matter', data.get('sample_state'))
backend.addValue('sample_purity', data.get('sample_purity'))
......@@ -162,15 +170,16 @@ 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.
# TODO sample classification
backend.addValue('sample_microstructure', 'bulk sample, polycrystalline')
backend.addValue('sample_constituents', 'multi phase')
backend.closeSection('section_sample', sample_gid)
# Close sections in the reverse order
# backend.closeSection('section_data', data_gid)
backend.closeSection('section_experiment', root_gid)
# backend.closeSection('section_experiment_general_parameters', general_gid)
# backend.closeSection('section_experiment_source_parameters', source_gid)
# backend.closeSection('section_experiment_detector_parameters', detector_gid)
# backend.closeSection('section_experiment_sample_parameters', sample_gid)
backend.closeSection('section_experiment', root_gid)
This diff is collapsed.
{
"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",
......@@ -39,7 +41,7 @@
"tof_distance": 0.9,
"tof_voltages": [20],
"sample_bias": 29,
"magnification": [-1.5],
"magnification": -1.5,
"detector_voltages": [],
"detector_type": "MCP",
"sensor_size": [],
......