Skip to content

Commit

Permalink
Updated order of air-sensor-stats inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhagan committed Sep 13, 2024
1 parent 68f4d91 commit 63d7a22
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion atmospy/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def air_sensor_stats(actual: np.ndarray, predicted: np.ndarray):
raise ValueError("You cannot have NaN's present in your `predicted` array.")

# fit the data to a linear model
fit = linregress(predicted, actual)
fit = linregress(actual, predicted)

return SensorStatsResults(
fit.slope,
Expand Down
7 changes: 6 additions & 1 deletion docs/examples/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@
ylim=(0, 60),
color="g",
# title="Performance of Sensor A vs US EPA FEM Reference"
)
)

# print out the stats
df = df.dropna(how='any', subset=["Reference", "Sensor A"])
stats = atmospy.air_sensor_stats(actual=df["Reference"], predicted=df["Sensor A"])
print (stats.asdict())
2 changes: 1 addition & 1 deletion docs/examples/regression.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Compare Two Sensors

.. image:: _images/regression.png

**atmospy components used:** :func:`set_theme`, :func:`load_dataset`, :func:`regplot`
**atmospy components used:** :func:`set_theme`, :func:`load_dataset`, :func:`regplot`, :func:`air_sensor_stats`

.. literalinclude:: regression.py
:lines: 7-
Expand Down
1 change: 0 additions & 1 deletion examples/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
df, x="Reference", y="Sensor A",
ylim=(0, 60),
color="g",
# title="Performance of Sensor A vs US EPA FEM Reference"
)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "atmospy"
version = "0.1.2"
version = "0.1.3"
description = "Data analysis and visualization for air quality data."
authors = ["David H Hagan <[email protected]>"]
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def prep_diel_dataset(rs='1min'):

# Adjust the timezone
single_site_ozone.loc[:, 'Timestamp Local'] = single_site_ozone['Timestamp GMT'].apply(lambda x: x + pd.Timedelta(hours=-7))

# Resample to {rs}min
single_site_ozone = single_site_ozone.set_index("Timestamp Local").resample(rs).interpolate('linear').reset_index()
single_site_ozone = single_site_ozone.set_index("Timestamp Local").resample(rs).interpolate('ffill').reset_index()

# Adjust to ppb
single_site_ozone['Sample Measurement'] *= 1e3
Expand Down

0 comments on commit 63d7a22

Please sign in to comment.