From 0201a26394970be4aeafa9a424b9cfee6c064b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Sch=C3=B6ppach?= Date: Fri, 22 Nov 2024 15:43:47 +0100 Subject: [PATCH] Adress first review --- .../parsers/tandemparser.py | 11 +++++----- .../schema_packages/measurements.py | 21 ++++++++++++------- .../schema_packages/{ref.py => reference.py} | 2 +- .../schema_packages/schema.py | 2 +- .../schema_packages/tandem.py | 2 +- tests/test_tandem_schema.py | 5 ++++- 6 files changed, 26 insertions(+), 17 deletions(-) rename src/perovskite_tandem_database/schema_packages/{ref.py => reference.py} (96%) diff --git a/src/perovskite_tandem_database/parsers/tandemparser.py b/src/perovskite_tandem_database/parsers/tandemparser.py index d8d2b0f..28ad190 100644 --- a/src/perovskite_tandem_database/parsers/tandemparser.py +++ b/src/perovskite_tandem_database/parsers/tandemparser.py @@ -66,6 +66,7 @@ def parse( # Process each column/device/publication separately for col in data_frame.columns: logger.info(f'Processing column: {col}') + entry_archive = EntryArchive() # Clean the data frame # Set proper Boolean values and remove rows with all NaN values @@ -74,15 +75,13 @@ def parse( stack = extract_layer_stack(column_data) general = extract_general(column_data) reference = extract_reference(column_data) - reference.normalize(archive, logger) + # reference.normalize(entry_archive, logger) tandem = PerovskiteTandemSolarCell( general=general, reference=reference, layer_stack=stack ) - entry_archive = EntryArchive(data=tandem) - - print('parsing with tandem parser') + entry_archive.data = tandem create_archive( entry_archive.m_to_dict(), @@ -649,7 +648,9 @@ def extract_layer_stack(data_frame): # Filter out layers filtered_df = data_frame[data_frame.index.str.contains('Exist')] - layer_labels = [idx.split('Exist')[0] for idx in filtered_df.index] + layer_labels = [ + idx.split('Exist')[0].strip() for idx, val in filtered_df.items() if val + ] for label in layer_labels: # Filter dataframes by label diff --git a/src/perovskite_tandem_database/schema_packages/measurements.py b/src/perovskite_tandem_database/schema_packages/measurements.py index 1d5582f..3b45bb9 100644 --- a/src/perovskite_tandem_database/schema_packages/measurements.py +++ b/src/perovskite_tandem_database/schema_packages/measurements.py @@ -121,49 +121,49 @@ class Scan(ExperimentStep): description='Direction of the scan.', ) - jsc = Quantity( + short_circuit_current_density = Quantity( type=float, description='Short-circuit current density.', unit='mA/cm^2', ) - Voc = Quantity( + open_circuit_voltage = Quantity( type=float, description='Open-circuit voltage.', unit='V', ) - FF = Quantity( + fill_factor = Quantity( type=float, description='Fill factor.', unit='dimensionless', ) - PCE = Quantity( + power_conversion_efficiency = Quantity( type=float, description='Power conversion efficiency.', unit='dimensionless', ) - Vmp = Quantity( + maximum_power_point_voltage = Quantity( type=float, description='Voltage at maximum power.', unit='V', ) - jmp = Quantity( + maximum_power_point_current = Quantity( type=float, description='Current at maximum power.', unit='mA/cm^2', ) - Rs = Quantity( + restiance_series = Quantity( type=float, description='Series resistance.', unit='Ohm cm^2', ) - Rsh = Quantity( + resistance_shunt = Quantity( type=float, description='Shunt resistance.', unit='Ohm cm^2', @@ -175,6 +175,11 @@ class JV(Experiment): JV measurement. """ + target = Quantity( + type=str, + description='Target of the measurement.', + ) + illumination = SubSection( section_def=Illumination, description='Illumination conditions of the measurement.', diff --git a/src/perovskite_tandem_database/schema_packages/ref.py b/src/perovskite_tandem_database/schema_packages/reference.py similarity index 96% rename from src/perovskite_tandem_database/schema_packages/ref.py rename to src/perovskite_tandem_database/schema_packages/reference.py index 049f4cd..cf22c28 100644 --- a/src/perovskite_tandem_database/schema_packages/ref.py +++ b/src/perovskite_tandem_database/schema_packages/reference.py @@ -57,4 +57,4 @@ class Reference(PublicationReference): def normalize(self, archive, logger): """Normalize the reference section.""" - super(PublicationReference, self).normalize(archive, logger) + super().normalize(archive, logger) diff --git a/src/perovskite_tandem_database/schema_packages/schema.py b/src/perovskite_tandem_database/schema_packages/schema.py index 0747da3..74c4611 100644 --- a/src/perovskite_tandem_database/schema_packages/schema.py +++ b/src/perovskite_tandem_database/schema_packages/schema.py @@ -27,7 +27,7 @@ Substrate, ) -from .ref import Reference +from .reference import Reference from .tandem import ( General, Layer, diff --git a/src/perovskite_tandem_database/schema_packages/tandem.py b/src/perovskite_tandem_database/schema_packages/tandem.py index f30a6fc..f6ec507 100644 --- a/src/perovskite_tandem_database/schema_packages/tandem.py +++ b/src/perovskite_tandem_database/schema_packages/tandem.py @@ -13,7 +13,7 @@ from nomad.metainfo.util import MEnum # from perovskite_solar_cell_database.schema_sections.ions.ion import Ion -from .ref import Reference +from .reference import Reference # Chemicals and materials and their treatment diff --git a/tests/test_tandem_schema.py b/tests/test_tandem_schema.py index 856ccf2..e1eab6d 100644 --- a/tests/test_tandem_schema.py +++ b/tests/test_tandem_schema.py @@ -17,7 +17,10 @@ def test_schema(): normalize_all(entry_archive) # test reference - assert entry_archive.data.reference.DOI_number == '10.1002/advs.201700675' + assert ( + entry_archive.data.reference.DOI_number + == 'https://doi.org/10.1002/advs.201700675' + ) assert entry_archive.data.reference.data_entered_by_author is False # test general