Skip to content

Commit

Permalink
ruffing
Browse files Browse the repository at this point in the history
  • Loading branch information
Pepe-Marquez committed May 17, 2024
1 parent 819126b commit 1a51327
Show file tree
Hide file tree
Showing 27 changed files with 115 additions and 111 deletions.
2 changes: 1 addition & 1 deletion src/perovskite_solar_cell_database/data_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .entry_writer import PerovskiteEntryWriter, MyEncoder
from .entry_writer import MyEncoder, PerovskiteEntryWriter
from .eqe_parser import EQEAnalyzer
from .jv_parser import jv_dict_generator
8 changes: 4 additions & 4 deletions src/perovskite_solar_cell_database/data_tools/entry_writer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright The NOMAD Authors.
#
Expand All @@ -17,12 +16,13 @@
# limitations under the License.
#

import pandas as pd
import json
import numpy
import os
from collections import defaultdict
from datetime import date, datetime
import os

import numpy
import pandas as pd


class PerovskiteEntryWriter:
Expand Down
9 changes: 4 additions & 5 deletions src/perovskite_solar_cell_database/data_tools/eqe_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright The NOMAD Authors.
#
Expand All @@ -23,13 +22,13 @@
# Initially translated to Python by Christian Wolff


from scipy import integrate, optimize
import os

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
from scipy import integrate, optimize
from scipy.signal import savgol_filter
import matplotlib.pyplot as plt


# Constants
temperature = 300 # in [°K]
Expand Down
34 changes: 17 additions & 17 deletions src/perovskite_solar_cell_database/data_tools/jv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

def jv_dict_generator(filename):
# Block to clean up some bad characters found in the file which gives trouble reading.
f = open(filename, 'r', encoding='cp1252')
f = open(filename, encoding='cp1252')
filedata = f.read()
f.close()

Expand Down Expand Up @@ -90,38 +90,38 @@ def jv_dict_generator(filename):
for i in list_columns:
if 'rev' in i:
jv_dict['reverse_scan_Jsc'].append(
float('{:0.3e}'.format(abs(df[i].iloc[0])))
float(f'{abs(df[i].iloc[0]):0.3e}')
)
jv_dict['reverse_scan_Voc'].append(float('{:0.3e}'.format(df[i].iloc[1])))
jv_dict['reverse_scan_FF'].append(float('{:0.3e}'.format(df[i].iloc[2])))
jv_dict['reverse_scan_PCE'].append(float('{:0.3e}'.format(df[i].iloc[3])))
jv_dict['reverse_scan_Vmp'].append(float('{:0.3e}'.format(df[i].iloc[6])))
jv_dict['reverse_scan_Voc'].append(float(f'{df[i].iloc[1]:0.3e}'))
jv_dict['reverse_scan_FF'].append(float(f'{df[i].iloc[2]:0.3e}'))
jv_dict['reverse_scan_PCE'].append(float(f'{df[i].iloc[3]:0.3e}'))
jv_dict['reverse_scan_Vmp'].append(float(f'{df[i].iloc[6]:0.3e}'))
jv_dict['reverse_scan_Jmp'].append(
float('{:0.3e}'.format(abs(df[i].iloc[5])))
float(f'{abs(df[i].iloc[5]):0.3e}')
)
jv_dict['reverse_scan_series_resistance'].append(
float('{:0.3e}'.format(df[i].iloc[7]))
float(f'{df[i].iloc[7]:0.3e}')
)
jv_dict['reverse_scan_shunt_resistance'].append(
float('{:0.3e}'.format(df[i].iloc[8]))
float(f'{df[i].iloc[8]:0.3e}')
)

elif 'for' in i:
jv_dict['forward_scan_Jsc'].append(
abs(float('{:0.3e}'.format(df[i].iloc[0])))
abs(float(f'{df[i].iloc[0]:0.3e}'))
)
jv_dict['forward_scan_Voc'].append(float('{:0.3e}'.format(df[i].iloc[1])))
jv_dict['forward_scan_FF'].append(float('{:0.3e}'.format(df[i].iloc[2])))
jv_dict['forward_scan_PCE'].append(float('{:0.3e}'.format(df[i].iloc[3])))
jv_dict['forward_scan_Vmp'].append(float('{:0.3e}'.format(df[i].iloc[6])))
jv_dict['forward_scan_Voc'].append(float(f'{df[i].iloc[1]:0.3e}'))
jv_dict['forward_scan_FF'].append(float(f'{df[i].iloc[2]:0.3e}'))
jv_dict['forward_scan_PCE'].append(float(f'{df[i].iloc[3]:0.3e}'))
jv_dict['forward_scan_Vmp'].append(float(f'{df[i].iloc[6]:0.3e}'))
jv_dict['forward_scan_Jmp'].append(
float('{:0.3e}'.format(abs(df[i].iloc[5])))
float(f'{abs(df[i].iloc[5]):0.3e}')
)
jv_dict['forward_scan_series_resistance'].append(
float('{:0.3e}'.format(df[i].iloc[7]))
float(f'{df[i].iloc[7]:0.3e}')
)
jv_dict['forward_scan_shunt_resistance'].append(
float('{:0.3e}'.format(df[i].iloc[8]))
float(f'{df[i].iloc[8]:0.3e}')
)

jv_dict['no_cells'] = len(jv_dict['reverse_scan_Jsc'])
Expand Down
33 changes: 14 additions & 19 deletions src/perovskite_solar_cell_database/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,30 @@
)

if TYPE_CHECKING:
from nomad.datamodel.datamodel import (
EntryArchive,
)
from structlog.stdlib import (
BoundLogger,
)
pass

from nomad.datamodel.data import UseCaseElnCategory
from nomad.config import config
from nomad.datamodel.data import Schema
from nomad.datamodel.data import Schema, UseCaseElnCategory
from nomad.metainfo import SchemaPackage, Section, SubSection

from .schema_sections import (
Ref,
Cell,
Module,
Substrate,
EQE,
ETL,
Perovskite,
PerovskiteDeposition,
HTL,
Backcontact,
JV,
Add,
Backcontact,
Cell,
Encapsulation,
JV,
Module,
Outdoor,
Perovskite,
PerovskiteDeposition,
Ref,
Stabilised,
EQE,
Stability,
Outdoor,
Substrate,
)
from nomad.metainfo import Package, Section, SubSection, SchemaPackage

configuration = config.get_plugin_entry_point('perovskite_solar_cell_database:schema')

Expand Down
24 changes: 12 additions & 12 deletions src/perovskite_solar_cell_database/schema_sections/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from .ref import Ref
from .add import Add
from .backcontact import Backcontact
from .cell import Cell
from .module import Module
from .substrate import Substrate
from .encapsulation import Encapsulation
from .eqe import EQE
from .etl import ETL
from .perovskite import Perovskite
from .perovskite_deposition import PerovskiteDeposition
from .formula_normalizer import PerovskiteFormulaNormalizer
from .htl import HTL
from .backcontact import Backcontact
from .add import Add
from .encapsulation import Encapsulation
from .ions.ion import Ion
from .jv import JV, JVcurve
from .module import Module
from .outdoor import Outdoor
from .perovskite import Perovskite
from .perovskite_deposition import PerovskiteDeposition
from .ref import Ref
from .stabilised import Stabilised
from .eqe import EQE
from .stability import Stability
from .outdoor import Outdoor
from .substrate import Substrate
from .utils import add_band_gap, add_solar_cell
from .formula_normalizer import PerovskiteFormulaNormalizer
from .ions.ion import Ion
3 changes: 1 addition & 2 deletions src/perovskite_solar_cell_database/schema_sections/add.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity


class Add(ArchiveSection):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity

from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell


class Backcontact(ArchiveSection):
Expand Down
8 changes: 5 additions & 3 deletions src/perovskite_solar_cell_database/schema_sections/cell.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import numpy as np
from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from .vars import cell_enum_edit_quantity_suggestions
from nomad.datamodel.results import Properties
from nomad.metainfo import Quantity

from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell

from .vars import cell_enum_edit_quantity_suggestions


class Cell(ArchiveSection):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity


class Encapsulation(ArchiveSection):
Expand Down
5 changes: 3 additions & 2 deletions src/perovskite_solar_cell_database/schema_sections/eqe.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import numpy as np
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.metainfo.plot import PlotSection
from nomad.metainfo import Quantity, Section
from nomad.datamodel.data import ArchiveSection
from .perovskite import Perovskite
from nomad.units import ureg

from .perovskite import Perovskite


class EQE(PlotSection, ArchiveSection):
"""
Expand Down
8 changes: 5 additions & 3 deletions src/perovskite_solar_cell_database/schema_sections/etl.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from .vars import etl_enum_edit_quantity_suggestions
from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity

from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell

from .vars import etl_enum_edit_quantity_suggestions


class ETL(ArchiveSection):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright The NOMAD Authors.
#
Expand All @@ -17,6 +16,7 @@
# limitations under the License.

import re

from pymatgen.core import Composition

preprocess_rules = {'FAPbI': 'FAPbI3', 'MAPbI': 'MAPbI3'}
Expand Down
5 changes: 3 additions & 2 deletions src/perovskite_solar_cell_database/schema_sections/htl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity

from perovskite_solar_cell_database.schema_sections.utils import add_solar_cell


class HTL(ArchiveSection):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .ion import Ion
from .ion_vars import (
ion_a,
ion_b,
ion_c,
ion_a_coefficients,
ion_b,
ion_b_coefficients,
ion_c,
ion_c_coefficients,
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from nomad.datamodel.metainfo.basesections import PureSubstanceSection
from nomad.metainfo import Quantity
import openpyxl
import os

import openpyxl
from ase import Atoms
from nomad.datamodel.metainfo.basesections import PureSubstanceSection
from nomad.metainfo import Quantity


class Ion(PureSubstanceSection):
Expand Down
7 changes: 4 additions & 3 deletions src/perovskite_solar_cell_database/schema_sections/jv.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import numpy as np
from .utils import add_solar_cell
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.metainfo.plot import PlotSection
from nomad.metainfo import Quantity, Section, SubSection
from nomad.units import ureg
from nomad.metainfo import Section, Quantity, SubSection
from nomad.datamodel.data import ArchiveSection

from .utils import add_solar_cell


class JVcurve(PlotSection, ArchiveSection):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity


class Module(ArchiveSection):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity


class Outdoor(ArchiveSection):
Expand Down
22 changes: 11 additions & 11 deletions src/perovskite_solar_cell_database/schema_sections/perovskite.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
from perovskite_solar_cell_database.schema_sections.utils import (
add_solar_cell,
add_band_gap,
)
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.results import Material, System
from nomad.metainfo import Quantity, SubSection

from perovskite_solar_cell_database.schema_sections.ions.ion import (
Ion,
optimize_molecule,
)
from nomad.metainfo import Quantity, SubSection
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.results import Material
from nomad.datamodel.results import System
from ase.build import molecule
from perovskite_solar_cell_database.schema_sections.utils import (
add_band_gap,
add_solar_cell,
)


class Perovskite(ArchiveSection):
Expand Down Expand Up @@ -6568,10 +6567,11 @@ class Perovskite(ArchiveSection):
def normalize(self, archive, logger):
super().normalize(archive, logger)

from .formula_normalizer import PerovskiteFormulaNormalizer
from nomad.atomutils import Formula
from nomad.datamodel.results import Symmetry

from .formula_normalizer import PerovskiteFormulaNormalizer

add_solar_cell(archive)
add_band_gap(archive, self.band_gap)

Expand Down Expand Up @@ -6680,9 +6680,9 @@ def normalize(self, archive, logger):

self.ions = ions

from nomad.normalizing.topology import add_system_info, add_system
from nomad.datamodel.results import Relation
from nomad.normalizing.common import nomad_atoms_from_ase_atoms
from nomad.normalizing.topology import add_system, add_system_info

topology = {}
# Add original system
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
from nomad.metainfo import Quantity
from nomad.datamodel.data import ArchiveSection
from nomad.metainfo import Quantity

from .utils import add_solar_cell


Expand Down
Loading

0 comments on commit 1a51327

Please sign in to comment.