Repository navigation
feat(language)!: a parameter value that is infinite is refused when the data is attached, and a where that names a parameter with a row everywhere is refused at load - #869
Conversation
…he data is attached `missing:` now spells every use `inf` had in data, so the language refuses an infinite value as it refuses null and NaN. The PyPSA spec declares its caps and energy budgets `missing: absent` instead of reading an infinite row, and its maintenance assumptions test for a row. Closes #863 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XUtBEYS2M2gYZzMGC5xuLV
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XUtBEYS2M2gYZzMGC5xuLV
Documentation build overview
19 files changed ·
|
|
@FabianHofmann That's the last PR id like to bring in for v0.3.0 |
… is refused at load A bare `float` name under `missing: refused` is now refused in a mask, as an `int` or `str` one is: data holds no infinite value, so the name is true at every coordinate. Inside `count`, `shift` and `at` a bare name of any dtype loads, because there it counts, steps off an edge or joins. A curve no longer claims completeness of a `refused` table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XUtBEYS2M2gYZzMGC5xuLV
|
@FBumann so if there is a |
|
The exact meaning of inf, nan etc is somewhat the responsibility of the engine. If an engine is strict, it should refuse both nan and inf, as both should be rather be expressed by missing:absent. Users with nan or inf data would then be forced to explicitly filter out inf/nan rules. Happy to discuss the implications. I imagine refusing inf and nan makes the data contract much safer. Pypsa currently passes inf, but that's for legacy reasons I think. An absent row would be the more honest spelling. And more data efficient. |
|
Yeah, I think |
|
So we would treat it like: |
|
@brynpickering Im having some second thoughts about this. |
|
Closed in favor of #880 |
Note
The following content was generated by AI.
What this changes
Data can no longer hold
infor-inf. The PyPSA spec declares its caps and budgetsmissing: absent. A bare name of arefusedparameter that stands in a mask is a load error for every dtype exceptbool. Insidecount,shiftandat, a bare name loads. Closes #863.Why
missing:(#810) gives every use ofinfin data a spelling in the file. An infinite coefficient is never a number a solver can take (fluxopt/specsolve#1905). Withoutinf, a barefloatname underrefusedis true at every coordinate, as a bareintorstrname already was. The load rule says so for all three. Insidecount,shiftandatthe name still does work, so the rule does not apply there.Method, gate output, what was not done
Language (
docs/reference/language/,program.pydocstrings)declarations.md: null, NaN and infinite values are refused when the data is attached.missing: .infreads a missing row as infinite. Thefloattype row says that data cannot hold.inf. The bare-name paragraph gives the new rule.expressions.mdandabsence.mdsay the same.assumptions.md:curve_completeis written only for a values table that is notrefused.Load rule (
_where_resolver.py)refusedparameter is now refused for every dtype exceptbool. Before, the rule covered onlyintandstr.count,shiftandatwith anoperandflag, so the rule does not apply there. Forintandstr, this loosens the rule:count(n, over=g)loaded before only for afloat.Piecewise (
piecewise.py,lowering.py){curve}_completenames only the values tables that are notrefused. A curve whose tables are allrefusedwrites no_complete, because attaching the data already refuses a missing breakpoint.Emittedstill reserves the name.refusedtable underpoints:is now raised before the curve's assumptions resolve. Before, a bare-name refusal inside a generated assumption reached an internalassert.PyPSA spec (
examples/pypsa.yaml, then the 24 fragments fromtools.pypsa_split, then the generated pages)missing: absentonGenerator_p_nom_max,Link_p_nom_max,Process_p_nom_max,StorageUnit_p_nom_max,Store_e_nom_max,Line_s_nom_max,Transformer_s_nom_max,Generator_e_sum_minandGenerator_e_sum_max.holds: "X_p_nom_max < inf"toholds: "X_p_nom_max". The rows that refuse a network stay the same.count(scenario_weight, over=scenario)stays as written.Tests where the old behaviour moved
a-float-may-hold-infis removed.where-a-bare-float-parameter-under-refusedreplaces it.refusedcase oftest_under_a_reading_a_missing_row_compares_falseis removed. That spec is now a load error.test_a_bare_name_under_refused_loads_inside_count_shift_and_at(float, int and str × count, shift and at). On the old tree, the int and str cases failed.test_a_curve_whose_tables_are_refused_states_no_completeness.floatunderrefusedin a mask. They now declare itmissing: absentorneutral, or they compare it: the golden typesetting spec (budget > 0, andrun_startisNOT shift(load, …)), thetest_walk,test_symbols,test_lowering,test_dimensionsandtest_exclusivityfixtures, and the sixtests/expand/curve-*/after.yamlfiles, which losecurve_complete.Mutation table (whole suite, each guard removed alone)
not self.operandin the bare-name ruleif name not in refusedinassumptions_ofrefused_under_pointsraise inlowerGates
pixi run lint: passes.pixi run test: 2861 passed, 1 skipped.docs-buildandcompile-texdid not run here. The sandbox proxy blocksdocs.python.organd the tectonic bundle host. GitHub CI runs both.Not done
infrefusal.missing: .infstays, as the issue proposes.infat attach and to drop theinfrows in its PyPSA data preparation.🤖 Generated with Claude Code
https://claude.ai/code/session_01XUtBEYS2M2gYZzMGC5xuLV