worklab 2.3.8__tar.gz → 2.3.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worklab
3
- Version: 2.3.8
3
+ Version: 2.3.9
4
4
  Summary: Basic scripts for worklab devices
5
5
  Author-email: Sophie de Klerk <r.de.klerk@pl.hanze.nl>, Thomas Rietveld <t.rietveld@lboro.ac.uk>, Rowie Janssen <r.j.f.janssen@umcg.nl>, Jelmer Braaksma <j.braaksma01@umcg.nl>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "worklab"
3
- version = "2.3.8"
3
+ version = "2.3.9"
4
4
  description = "Basic scripts for worklab devices"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.7"
@@ -554,7 +554,7 @@ def ana_sprint(data, data_pbp, half=5, title=None):
554
554
  return fig, outcomes
555
555
 
556
556
 
557
- def ana_submax(data_ergo, data_pbp, data_spiro):
557
+ def ana_submax(data_ergo, data_pbp, data_spiro=None):
558
558
  """
559
559
  Sub maximal test analyse. Saves important outcomes
560
560
 
@@ -572,8 +572,6 @@ def ana_submax(data_ergo, data_pbp, data_spiro):
572
572
  outcomes : pd.DataFrame
573
573
 
574
574
  """
575
- mean_spiro = calc_weighted_average(data_spiro[["RER", "EE", "HR", "VO2"]], data_spiro["weights"])
576
- mean_spiro = pd.DataFrame(mean_spiro).T
577
575
 
578
576
  mean_ergo = [
579
577
  {
@@ -581,8 +579,10 @@ def ana_submax(data_ergo, data_pbp, data_spiro):
581
579
  "meanpower": data_ergo["mean"]["power"].mean(),
582
580
  "ptime_l": data_pbp["left"]["ptime"].mean(),
583
581
  "ptime_r": data_pbp["right"]["ptime"].mean(),
582
+ "ptime": data_pbp['mean']['ptime'].mean(),
584
583
  "ctime_l": data_pbp["left"]["ctime"].mean(),
585
584
  "ctime_r": data_pbp["right"]["ctime"].mean(),
585
+ "ctime": data_pbp['mean']['ctime'].mean(),
586
586
  "ca_l": data_pbp["left"]["cangle_deg"].mean(),
587
587
  "ca_r": data_pbp["right"]["cangle_deg"].mean(),
588
588
  "meanpowerperpush": data_pbp["mean"]["meanpower"].mean(),
@@ -591,13 +591,22 @@ def ana_submax(data_ergo, data_pbp, data_spiro):
591
591
  "slope": data_pbp["mean"]["slope"].mean(),
592
592
  "smoothness": data_pbp["mean"]["smoothness"].mean(),
593
593
  "freq": 1 / data_pbp["mean"]["ctime"].mean(),
594
+ "pushes": len(data_pbp["mean"]),
594
595
  }
595
596
  ]
596
597
 
597
598
  mean_ergo = pd.DataFrame(mean_ergo)
598
599
 
599
- outcomes = pd.concat([mean_ergo, mean_spiro], axis=1)
600
- outcomes["me"] = (outcomes["meanpower"] / outcomes["EE"]) * 100
600
+ if data_spiro is not None:
601
+ if data_spiro["HR"].isna().all():
602
+ mean_spiro = calc_weighted_average(data_spiro[["RER", "EE", "VO2"]], data_spiro["weights"])
603
+ else:
604
+ mean_spiro = calc_weighted_average(data_spiro[["RER", "EE", "HR", "VO2"]], data_spiro["weights"])
605
+ mean_spiro = pd.DataFrame(mean_spiro).T
606
+ outcomes = pd.concat([mean_ergo, mean_spiro], axis=1)
607
+ outcomes["me"] = (outcomes["meanpower"] / outcomes["EE"]) * 100
608
+ else:
609
+ outcomes = mean_ergo
601
610
  return outcomes
602
611
 
603
612
 
@@ -243,7 +243,10 @@ def load_spiro_metamax(filename, sheet_name=0):
243
243
  data["VO2"] = data["VO2"].astype(float)
244
244
  data["EE"] = ((4.94 * data["RER"] + 16.04) * (1000 * data["VO2"])) / 60
245
245
  data["weights"] = np.insert(np.diff(data["time"]), 0, 0) # used for calculating weighted average
246
- data["HR"] = (np.nan if "HR" not in data else data["HR"]).astype(int) # missing when sensor is not detected
246
+ if "HR" not in data or data["HR"].isna().all():
247
+ data["HR"] = np.nan
248
+ else:
249
+ data["HR"] = data["HR"].astype(float)
247
250
  data["O2pulse"] = data["VO2"] / data["HR"]
248
251
  data["VCO2"].replace(0, 0.01, inplace=True)
249
252
  data["VO2"].replace(0, 0.01, inplace=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worklab
3
- Version: 2.3.8
3
+ Version: 2.3.9
4
4
  Summary: Basic scripts for worklab devices
5
5
  Author-email: Sophie de Klerk <r.de.klerk@pl.hanze.nl>, Thomas Rietveld <t.rietveld@lboro.ac.uk>, Rowie Janssen <r.j.f.janssen@umcg.nl>, Jelmer Braaksma <j.braaksma01@umcg.nl>
6
6
  License: GNU GENERAL PUBLIC LICENSE
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes