Skip to content

Commit

Permalink
Fix writing of value
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Nov 12, 2024
1 parent d8239e6 commit 512dee6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/nomad_simulations/schema_packages/physical_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _is_derived(self) -> bool: # ?
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)

self.is_derived = self._is_derived() # ?
# self.is_derived = self._is_derived() # ?

try:
if self.value is not None:
Expand All @@ -274,11 +274,17 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
except AttributeError:
raise AttributeError('The `value` or `_base_value` is not defined at the _quantity_ level.')

value_def = self.m_def.all_quantities.get('_base_value')
value_def.label = 'value'
value_def.shape = self.full_shape
self.m_add_sub_section(Quantity(name=value_def.label, type=value_def.type, unit=value_def.unit, shape=value_def.shape, description=value_def.description), value_def)
self.value = value #.to(value_def.unit).magnitude if value is not None else None
self.m_def.quantities.append(
Quantity(
name='value',
shape=self.full_shape,
type=self.m_def.all_quantities['_base_value'].type,
unit=self.m_def.all_quantities['_base_value'].unit,
description=self.m_def.all_quantities['_base_value'].description,
)
)
if value is not None: # ! pin down type
self.value = value.to(self.m_def.all_quantities['value'].unit).magnitude


class PropertyContribution(PhysicalProperty):
Expand Down

1 comment on commit 512dee6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_simulations/schema_packages
   __init__.py15287%39–41
   atoms_state.py19012932%13–15, 159–179, 197–232, 245–276, 279–297, 344–355, 358–372, 491–506, 518–526, 529–550, 608–615, 627–634, 637–643
   basis_set.py24015336%8–9, 78–79, 115–119, 122–133, 162–165, 168–169, 172–185, 208, 264, 270–271, 275–279, 290–294, 298–302, 306–327, 335, 370–381, 385–397, 417–418, 453–466, 470, 475–476, 513–521, 530, 562–589, 595–600, 603–618, 647–698
   general.py894253%4–7, 51–54, 121, 185, 214–216, 228–286, 289–311
   model_method.py26915443%10–12, 73, 92, 125, 171–174, 177–184, 276–277, 297, 318–339, 355–381, 384–401, 493, 516–559, 562–587, 637–645, 704–706, 732–753, 756–762, 780, 791, 833–840, 878, 897, 977, 1034, 1109, 1223
   model_system.py34822037%45–51, 207–215, 219–225, 234–236, 243, 246, 250, 254, 258, 261, 264, 273–282, 286–291, 374–377, 381, 385, 389, 393, 397, 401, 404, 449–455, 466–475, 489–520, 531–548, 551–554, 685–712, 730–812, 815–831, 897–901, 904–925, 1131–1169, 1172–1211
   numerical_settings.py25919525%12–14, 36, 147, 175–191, 213–284, 374–394, 410–425, 444–466, 469–496, 561–582, 594–610, 632–662, 680–742, 745–766, 792–794, 809–827, 830–835, 884–886, 889
   outputs.py1206843%9–10, 153–159, 169–173, 183–187, 190–198, 241–259, 276–309, 312–329, 362, 381
   physical_property.py984752%20–22, 46–62, 188–190, 202–207, 228, 237, 244–247, 258–260, 263–287, 309–311
   variables.py862176%8–10, 63–70, 73–76, 98, 121, 145, 167, 189, 211, 233, 256, 272–273, 276
src/nomad_simulations/schema_packages/properties
   band_gap.py513237%8–10, 79–92, 104–126, 129–144
   band_structure.py1227539%9–11, 54, 57, 130–131, 143–158, 173–198, 208–217, 231–264, 273–285, 288–307, 320–321, 324, 371–372, 377
   energies.py411759%7–9, 36, 57, 75–76, 79, 96–97, 100, 112–113, 116, 127–128, 131
   fermi_surface.py16662%7–9, 36–38, 41
   forces.py22864%7–9, 36, 56, 75–76, 79
   greens_function.py995247%7–9, 135–137, 149–179, 182–189, 210–211, 214, 235–236, 239, 260–261, 264, 349–355, 365–367, 376–384, 387–403
   hopping_matrix.py27967%7–9, 51–52, 57, 88–89, 92
   permittivity.py473134%7–9, 54–56, 59–62, 71–94, 97–105
   spectral_profile.py25921417%9–11, 39, 48–50, 53–59, 79, 93–105, 108–111, 175–176, 198–299, 312–344, 355–367, 381–399, 414–462, 465–501, 518–520, 523, 550–552, 563–588, 593–599
   thermodynamics.py732467%7–9, 35, 56, 72, 81, 90, 101, 110, 137, 147, 157, 170–171, 174, 190, 218–219, 222, 238, 259–260, 263
src/nomad_simulations/schema_packages/utils
   utils.py795629%8–11, 48–58, 65–74, 78–84, 87–92, 96, 100, 117–122, 139–145, 154–156, 165–170
TOTAL2576155939% 

Tests Skipped Failures Errors Time
1 0 💤 0 ❌ 1 🔥 1.365s ⏱️

Please sign in to comment.