Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • berntm/saqc
  • rdm-software/saqc
  • schueler/saqc
3 results
Show changes
Commits on Source (2)
...@@ -13,12 +13,12 @@ SPDX-License-Identifier: GPL-3.0-or-later ...@@ -13,12 +13,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
- Option to change the flagging scheme after initialization - Option to change the flagging scheme after initialization
- `flagByClick`: manually assign flags using a graphical user interface - `flagByClick`: manually assign flags using a graphical user interface
- `SaQC`: support for selection, slicing and setting of items by use of subscription on SaQC objects (e.g. `qc[key]` and `qc[key] = value`). - `SaQC`: support for selection, slicing and setting of items by use of subscription on SaQC objects (e.g. `qc[key]` and `qc[key] = value`).
Selection works with single keys, collections of keys and string slices (e.g. `qc["a":"f"]`). Values can be SaQC objects, pd.Series, Selection works with single keys, collections of keys and string slices (e.g. `qc["a":"f"]`). Values can be SaQC objects, pd.Series,
Iterable of Series and dict-like with series values. Iterable of Series and dict-like with series values.
- `transferFlags` is a multivariate function - `transferFlags` is a multivariate function
- `plot`: added `yscope` keyword - `plot`: added `yscope` keyword
- `setFlags`: function to replace `flagManual` - `setFlags`: function to replace `flagManual`
- `flagUniLOF`: added defaultly applied correction to mitigate phenomenon of overflagging at relatively steep data value slopes. (parameter `slope_correct`). - `flagUniLOF`: added defaultly applied correction to mitigate phenomenon of overflagging at relatively steep data value slopes. (parameter `slope_correct`).
### Changed ### Changed
### Removed ### Removed
### Fixed ### Fixed
......
...@@ -9,7 +9,7 @@ matplotlib==3.8.3 ...@@ -9,7 +9,7 @@ matplotlib==3.8.3
numpy==1.26.4 numpy==1.26.4
outlier-utils==0.0.5 outlier-utils==0.0.5
pyarrow==15.0.0 pyarrow==15.0.0
pandas==2.1.4 pandas==2.2.1
scikit-learn==1.4.1.post1 scikit-learn==1.4.1.post1
scipy==1.12.0 scipy==1.12.0
typing_extensions==4.5.0 typing_extensions==4.5.0
......
...@@ -148,7 +148,8 @@ class MappingScheme(TranslationScheme): ...@@ -148,7 +148,8 @@ class MappingScheme(TranslationScheme):
out = DictOfSeries() out = DictOfSeries()
expected = pd.Index(trans_map.values()) expected = pd.Index(trans_map.values())
for field in flags.columns: for field in flags.columns:
out[field] = flags[field].replace(trans_map) with pd.option_context("future.no_silent_downcasting", True):
out[field] = flags[field].replace(trans_map).infer_objects()
diff = pd.Index(out[field]).difference(expected) diff = pd.Index(out[field]).difference(expected)
if not diff.empty: if not diff.empty:
raise ValueError( raise ValueError(
......
...@@ -177,7 +177,24 @@ def periodicMask( ...@@ -177,7 +177,24 @@ def periodicMask(
x[e:e] = True x[e:e] = True
return x return x
freq = "1" + "mmmhhhdddMMMYYY"[len(season_start)] freq = (
"1",
"m",
"m",
"m",
"h",
"h",
"h",
"d",
"d",
"d",
"M",
"M",
"M",
"YE",
"YE",
"YE",
)[len(season_start)]
out = mask.groupby(pd.Grouper(freq=freq)).transform(_selector) out = mask.groupby(pd.Grouper(freq=freq)).transform(_selector)
if invert: if invert:
out = ~out out = ~out
......
...@@ -52,7 +52,7 @@ def test_flagRange(data, field): ...@@ -52,7 +52,7 @@ def test_flagRange(data, field):
assert all(flagged == expected) assert all(flagged == expected)
def test_flagSeasonalRange(data, field): def test_selectTime(data, field):
data[field].iloc[::2] = 0 data[field].iloc[::2] = 0
data[field].iloc[1::2] = 50 data[field].iloc[1::2] = 50
nyears = len(data[field].index.year.unique()) nyears = len(data[field].index.year.unique())
......
...@@ -33,7 +33,7 @@ def test_flagMad(spiky_data): ...@@ -33,7 +33,7 @@ def test_flagMad(spiky_data):
field, *_ = data.columns field, *_ = data.columns
flags = initFlagsLike(data) flags = initFlagsLike(data)
qc = SaQC(data, flags).flagZScore( qc = SaQC(data, flags).flagZScore(
field, window="1H", method="modified", thresh=3.5, flag=BAD field, window="1h", method="modified", thresh=3.5, flag=BAD
) )
flag_result = qc.flags[field] flag_result = qc.flags[field]
test_sum = (flag_result.iloc[spiky_data[1]] == BAD).sum() test_sum = (flag_result.iloc[spiky_data[1]] == BAD).sum()
......
...@@ -104,13 +104,13 @@ def daterangeIndexes(draw, min_size=0, max_size=100): ...@@ -104,13 +104,13 @@ def daterangeIndexes(draw, min_size=0, max_size=100):
max_date = pd.Timestamp("2099-12-31").to_pydatetime() max_date = pd.Timestamp("2099-12-31").to_pydatetime()
start = draw(datetimes(min_value=min_date, max_value=max_date)) start = draw(datetimes(min_value=min_date, max_value=max_date))
periods = draw(integers(min_value=min_size, max_value=max_size)) periods = draw(integers(min_value=min_size, max_value=max_size))
freq = draw(sampled_from(["D", "H", "T", "min", "S", "L", "ms", "U", "us", "N"])) freq = draw(sampled_from(["D", "h", "min", "s", "ms", "us", "ns"]))
return pd.date_range(start, periods=periods, freq=freq) return pd.date_range(start, periods=periods, freq=freq)
@composite @composite
def frequencyStrings(draw, _): def frequencyStrings(draw, _):
freq = draw(sampled_from(["D", "H", "T", "min", "S", "L", "ms", "U", "us", "N"])) freq = draw(sampled_from(["D", "h", "min", "s", "ms", "us", "ns"]))
mult = draw(integers(min_value=1, max_value=10)) mult = draw(integers(min_value=1, max_value=10))
value = f"{mult}{freq}" value = f"{mult}{freq}"
return value return value
......