Skip to content
Snippets Groups Projects
Commit bd3547dc authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

up

parent 8dc79b76
No related branches found
No related tags found
2 merge requests!39Release 0.4.0,!6Resulttable
Pipeline #9138 failed
...@@ -34,7 +34,7 @@ from caosadvancedtools.crawler import FileCrawler ...@@ -34,7 +34,7 @@ from caosadvancedtools.crawler import FileCrawler
from caosadvancedtools.guard import INSERT, UPDATE from caosadvancedtools.guard import INSERT, UPDATE
from caosadvancedtools.scifolder import (AnalysisCFood, ExperimentCFood, from caosadvancedtools.scifolder import (AnalysisCFood, ExperimentCFood,
PublicationCFood, SimulationCFood, PublicationCFood, SimulationCFood,
SoftwareCFood) SoftwareCFood, ResultTableCFood)
try: try:
from sss_helper import get_argument_parser, print_success from sss_helper import get_argument_parser, print_success
...@@ -89,7 +89,7 @@ if __name__ == "__main__": ...@@ -89,7 +89,7 @@ if __name__ == "__main__":
interactive=False, hideKnown=False, interactive=False, hideKnown=False,
cfood_types=[ExperimentCFood, AnalysisCFood, SoftwareCFood, cfood_types=[ExperimentCFood, AnalysisCFood, SoftwareCFood,
PublicationCFood, SimulationCFood, PublicationCFood, SimulationCFood,
]) ResultTableCFood])
if args.authorize_run: if args.authorize_run:
for run_id in args.authorize_run: for run_id in args.authorize_run:
......
...@@ -18,6 +18,14 @@ SoftwareVersion: ...@@ -18,6 +18,14 @@ SoftwareVersion:
binaries: binaries:
sourceCode: sourceCode:
Software: Software:
DepthTest:
obligatory_properties:
temperature:
datatype: DOUBLE
description: 'temp'
depth:
datatype: DOUBLE
description: 'temp'
Person: Person:
obligatory_properties: obligatory_properties:
firstName: firstName:
......
...@@ -57,6 +57,17 @@ class CrawlerTest(unittest.TestCase): ...@@ -57,6 +57,17 @@ class CrawlerTest(unittest.TestCase):
datfile.description) datfile.description)
assert os.path.basename(datfile.path) == "datafile.dat" assert os.path.basename(datfile.path) == "datafile.dat"
# There should be two DepthTest Properties
depthtests = exp.get_property("DepthTest")
assert len(depthtests) == 1
assert len(depthtests.value) == 2
depthtest = db.Record(id=depthtests.value[0])
depthtest.retrieve()
assert "DepthTest" in [p.name for p in project.get_parents()]
assert 234.4 == depthtest.get_property("temperature").value[0]
assert "°C" == depthtest.get_property("temperature").unit
assert 3.0 == depthtest.get_property("depth").value[0]
# Should have a responsible person # Should have a responsible person
self.assertIsNotNone(exp.get_property("responsible")) self.assertIsNotNone(exp.get_property("responsible"))
person = db.Record(id=exp.get_property("responsible").value[0]) person = db.Record(id=exp.get_property("responsible").value[0])
......
...@@ -3,3 +3,4 @@ from .experiment_cfood import ExperimentCFood ...@@ -3,3 +3,4 @@ from .experiment_cfood import ExperimentCFood
from .publication_cfood import PublicationCFood from .publication_cfood import PublicationCFood
from .simulation_cfood import SimulationCFood from .simulation_cfood import SimulationCFood
from .software_cfood import SoftwareCFood from .software_cfood import SoftwareCFood
from .result_table_cfood import ResultTableCFood
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import caosdb as db import caosdb as db
import re
import pandas as pd import pandas as pd
from caosadvancedtools.cfood import (AbstractFileCFood, assure_has_description, from caosadvancedtools.cfood import (AbstractFileCFood, assure_has_description,
assure_has_parent, assure_has_property, assure_has_parent, assure_has_property,
...@@ -63,7 +64,7 @@ class ResultTableCFood(AbstractFileCFood): ...@@ -63,7 +64,7 @@ class ResultTableCFood(AbstractFileCFood):
rec.add_parent(self.match.group("recordtype")) rec.add_parent(self.match.group("recordtype"))
for col in self.table.columns[:2]: for col in self.table.columns[:2]:
match = ResultTableCFood.match(col) match = re.match(ResultTableCFood.property_name_re, col)
if match.group("unit"): if match.group("unit"):
rec.add_property(match.group("pname"), row.loc[col], unit=match.group("unit")) rec.add_property(match.group("pname"), row.loc[col], unit=match.group("unit"))
...@@ -77,6 +78,7 @@ class ResultTableCFood(AbstractFileCFood): ...@@ -77,6 +78,7 @@ class ResultTableCFood(AbstractFileCFood):
def update_identifiables(self): def update_identifiables(self):
for ii, (idx, row) in enumerate(self.table.iterrows()): for ii, (idx, row) in enumerate(self.table.iterrows()):
for col in row.index: for col in row.index:
assure_property_is(self.recs[ii], col, row.loc[col], to_be_updated=self.to_be_updated) match = re.match(ResultTableCFood.property_name_re, col)
assure_property_is(self.recs[ii], match.group("pname"), row.loc[col], to_be_updated=self.to_be_updated)
assure_property_is(self.experiment, self.match.group("recordtype"), assure_property_is(self.experiment, self.match.group("recordtype"),
self.recs, to_be_updated=self.to_be_updated) self.recs, to_be_updated=self.to_be_updated)
demperature [°C] ,depth [m] temperature [°C] ,depth
234.4,3.0 234.4,3.0
344.6,5.1 344.6,5.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment