Skip to content

Commit 9220d5a

Browse files
authored
fix AeroDist ctor arg bug in README codes. Closes #393 (#394)
1 parent 7481527 commit 9220d5a

File tree

3 files changed

+4
-25
lines changed

3 files changed

+4
-25
lines changed

README.md

+4-10
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ aero_dist = ppmc.AeroDist(
143143
"num_conc": 3200 / si.cm**3,
144144
"geom_mean_diam": 8.64 * si.nm,
145145
"log10_geom_std_dev": 0.28,
146-
}
147-
},
148-
{
146+
},
149147
"diesel": {
150148
"mass_frac": [{"OC": [0.3]}, {"BC": [0.7]}],
151149
"diam_type": "geometric",
@@ -187,9 +185,7 @@ aero_dist = ppmc.AeroDist(aero_data, (
187185
"num_conc" => 3200 / si.cm^3,
188186
"geom_mean_diam" => 8.64 * si.nm,
189187
"log10_geom_std_dev" => .28,
190-
)
191-
),
192-
Dict(
188+
),
193189
"diesel" => Dict(
194190
"mass_frac" => (Dict("OC" => (.3,)), Dict("BC" => (.7,))),
195191
"diam_type" => "geometric",
@@ -198,7 +194,7 @@ aero_dist = ppmc.AeroDist(aero_data, (
198194
"geom_mean_diam" => 50 * si.nm,
199195
"log10_geom_std_dev" => .24,
200196
)
201-
)
197+
),
202198
))
203199

204200
n_part = 100
@@ -232,9 +228,7 @@ aero_dist = ppmc.AeroDist(aero_data, py.tuple({ ...
232228
"num_conc", 3200 / si.cm^3, ...
233229
"geom_mean_diam", 8.64 * si.nm, ...
234230
"log10_geom_std_dev", .28 ...
235-
)) ...
236-
)), ...
237-
py.dict(pyargs( ...
231+
)), ...
238232
"diesel", py.dict(pyargs( ...
239233
"mass_frac", py.tuple({ ...
240234
py.dict(pyargs("OC", py.tuple({.3}))), ...

src/aero_dist.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ struct AeroDist {
4949
ptr(f_aero_dist_ctor, f_aero_dist_dtor),
5050
aero_data(aero_data)
5151
{
52-
if (!InputJSONResource::unique_keys(json))
53-
throw std::runtime_error("Mode names must be unique");
5452
for (const auto &mode : json)
5553
AeroMode::check_mode_json(mode.begin().value());
5654

tests/test_aero_dist.py

-13
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,6 @@ def test_get_source_names():
188188
for i, key in enumerate(keys):
189189
assert sources[i] == key # pylint: disable=unsubscriptable-object
190190

191-
@staticmethod
192-
@pytest.mark.skipif(platform.machine() == "arm64", reason="TODO #348")
193-
def test_ctor_multimode_error_on_repeated_mode_names():
194-
# arrange
195-
aero_data = ppmc.AeroData(AERO_DATA_CTOR_ARG_MINIMAL)
196-
197-
# act
198-
with pytest.raises(Exception) as exc_info:
199-
ppmc.AeroDist(aero_data, AERO_DIST_CTOR_ARG_MINIMAL * 2)
200-
201-
# assert
202-
assert str(exc_info.value) == "Mode names must be unique"
203-
204191
@staticmethod
205192
@pytest.mark.skipif(platform.machine() == "arm64", reason="TODO #348")
206193
def test_ctor_error_on_repeated_massfrac_keys():

0 commit comments

Comments
 (0)