Skip to content

Conversation

@LianqiWang111
Copy link

@LianqiWang111 LianqiWang111 commented Oct 16, 2025

Description

This pull request introduces the implementation of the IREQ (Required Clothing Insulation) model according to ISO 11079.
The update includes:

  • A new model file pythermalcomfort/models/ireq.py implementing IREQ calculations.
  • Updated class definitions in classes_input.py and classes_return.py to support the new model.
  • Added unit tests in tests/test_ireq.py covering scalar, vectorized, and broadcasting input cases.
  • Updated documentation in docs/documentation/models.rst.
  • Updated CHANGELOG.rst.

Type of change

New feature (non-breaking change which adds functionality)
This change requires a documentation update

How Has This Been Tested?

All tests for the calc_ireq() function were conducted in tests/test_ireq.py using pytest.

Test A: Verified scalar input calculations to ensure numerical stability and physically valid outputs.

Test B: Verified vectorized and broadcasting input handling with NumPy arrays to ensure consistent output shapes and array compatibility.

Test Configuration:

Firmware version: N/A
Hardware: macOS (M1)
Toolchain: Python 3.11, pytest 8.4.1
SDK: N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features

    • Added IREQ (ISO 11079:2007) calculations producing IREQ, ICL and DLE results with structured, vectorised outputs and new input fields (duration, t_re, t_sk) and input types.
  • Bug Fixes / Quality

    • Strengthened input validation, broadcasting, numeric‑stability and finite‑value checks.
  • Documentation

    • Added user documentation for the IREQ model and outputs.
  • Tests

    • Comprehensive tests for scalar/array inputs, broadcasting, edge cases and invalid inputs.

…BuiltEnvironment/development

Development
…BuiltEnvironment/development

Development
…BuiltEnvironment/development

docs(changelog): Improve naming and formatting in changelog
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Walkthrough

Adds ISO 11079 IREQ computation: new vectorised calc_ireq() and IREQ dataclass, extends input surface with duration, t_re, t_sk and new input classes, updates docs and changelog, and adds comprehensive unit tests for scalar/array/broadcast and invalid cases.

Changes

Cohort / File(s) Summary
IREQ model & tests
pythermalcomfort/models/ireq.py, tests/test_ireq.py
New calc_ireq(...) implementing ISO 11079 IREQ and DLE calculations with NumPy broadcasting, iterative solvers, input validation and error handling. Unit tests cover scalar/array inputs, broadcasting, invalid inputs, edge cases, deterministic outputs and reference comparisons.
Input surface & new input classes
pythermalcomfort/classes_input.py
BaseInputs extended with duration, t_re, t_sk. Added IREQInputs and ScaleWindSpeedLogInputs; RidgeRegressionInputs signature updated. Extensive __post_init__ validations: broadcasting checks, finite/value ranges and cross-field consistency.
Return dataclasses
pythermalcomfort/classes_return.py
Added IREQ dataclass with fields ireq_min, ireq_neutral, icl_min, icl_neutral, dle_min, dle_neutral.
Docs & changelog
docs/documentation/models.rst, CHANGELOG.rst
Documentation entries and autodoc hooks added for calc_ireq and IREQ. Changelog updated with 3.8.0 entry documenting IREQ addition.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant calc_ireq as calc_ireq()
    participant Validate as _validate_inputs
    participant Physics as _compute_physics
    participant Solver as _solve_iterative
    participant Result as IREQ

    User->>calc_ireq: call calc_ireq(m, w_work, tdb, tr, p_air, v_walk, v, rh, clo)
    calc_ireq->>Validate: validate shapes, ranges, broadcastability
    Validate-->>calc_ireq: OK / raise ValueError

    calc_ireq->>Physics: unit conversions, air/skin properties, heat-transfer coeffs
    Physics-->>calc_ireq: physical params (i_air, h_c, vp, ...)

    calc_ireq->>Solver: iterative solve (neutral condition)
    Solver-->>calc_ireq: ireq_neutral, icl_neutral, dle_neutral

    calc_ireq->>Solver: iterative solve (minimum condition)
    Solver-->>calc_ireq: ireq_min, icl_min, dle_min

    calc_ireq->>Result: assemble IREQ dataclass
    Result-->>User: return structured results
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Focus review on:
    • pythermalcomfort/models/ireq.py: numerical solver convergence, unit conversions, broadcasting and mixed-dtype handling, DLE string vs numeric outputs.
    • pythermalcomfort/classes_input.py: broadcasting/validation interactions with existing inputs and added fields.
    • tests/test_ireq.py: reference-case tolerances and mixed-dtype array assertions.

Possibly related PRs

  • development #263 — overlaps on BaseInputs surface changes (adds duration, t_re, t_sk) and input-class signatures; likely code-level overlap.
  • Implement sleep set #191 — modifies BaseInputs and adds model modules; touches same input-class surface and validations.
  • development #187 — changes dataclass patterns in classes_return which may affect the new IREQ dataclass.

Suggested reviewers

  • FedericoTartarini

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat(models): add IREQ model and related documentation (ISO 11079)' accurately and concisely summarises the primary changes in the changeset. It clearly identifies the main feature addition (IREQ model implementation), references the relevant standard (ISO 11079), and encompasses the core modifications across the codebase including the new module, updated classes, documentation updates, and test coverage.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pythermalcomfort/classes_return.py (1)

313-334: PHS API regression vs CHANGELOG 3.6.0 — revert or document breaking change.

3.6.0 entry states water_loss and water_loss_watt were removed in favour of sweat_loss_g, sweat_rate_watt, evap_load_wm2_min. This change reintroduces water_loss* without updating 3.7.0 notes, creating an API inconsistency for users migrating from 3.6.x.

Please either:

  • Revert to the 3.6.0 fields, or
  • Explicitly document the reintroduction in 3.7.0 (with migration notes) and ensure the models that produce these values are aligned.

Happy to draft the changelog/migration snippet if you confirm the intended API.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c092bb and 57a0777.

📒 Files selected for processing (6)
  • CHANGELOG.rst (1 hunks)
  • docs/documentation/models.rst (1 hunks)
  • pythermalcomfort/classes_input.py (2 hunks)
  • pythermalcomfort/classes_return.py (6 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
  • tests/test_ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
docs/**/*.rst

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

docs/**/*.rst: Add an '.. autofunction:: pythermalcomfort.models..' entry to the docs for public APIs
Update the appropriate docs reference file that aggregates API docs when adding a public function

Files:

  • docs/documentation/models.rst
tests/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

tests/**/*.py: Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)
Use numpy.testing or pytest.approx for numeric assertions
Ensure tests are deterministic, small, and pass locally with pytest before PR

Files:

  • tests/test_ireq.py
CHANGELOG.*

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update the CHANGELOG for public API changes

Files:

  • CHANGELOG.rst
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
  • pythermalcomfort/classes_input.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
pythermalcomfort/classes_input.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Files:

  • pythermalcomfort/classes_input.py
🧠 Learnings (2)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • pythermalcomfort/classes_input.py
🧬 Code graph analysis (3)
tests/test_ireq.py (1)
pythermalcomfort/models/ireq.py (1)
  • calc_ireq (7-186)
pythermalcomfort/models/ireq.py (2)
pythermalcomfort/classes_input.py (1)
  • IREQInputs (1059-1083)
pythermalcomfort/classes_return.py (1)
  • IREQ (949-974)
pythermalcomfort/classes_input.py (1)
pythermalcomfort/utilities.py (4)
  • Units (36-40)
  • Postures (517-526)
  • Sex (43-47)
  • validate_type (393-401)
🔇 Additional comments (4)
pythermalcomfort/classes_return.py (2)

15-24: Nice, clearer str formatting for result classes.

Width-aligned listing improves readability for multi-line/numpy values. LGTM.


758-759: Minor: np.array vs np.asarray.

Functionally equivalent here. If you want to preserve subclass types (rare for dataclasses), np.asarray is slightly more general; otherwise np.array is fine. No action needed.

docs/documentation/models.rst (1)

168-175: Good docs wiring for the new IREQ model.

Autofunction and autoclass entries are correctly added under Models and match module paths. LGTM.

pythermalcomfort/classes_input.py (1)

19-69: LGTM! BaseInputs field definitions are well-structured.

The explicit field definitions with appropriate default values and type hints provide a solid foundation for input validation. The inclusion of both scalar and array types for numeric fields supports vectorized operations as per the coding guidelines.

CHANGELOG.rst Outdated
Comment on lines 4 to 13
3.7.0 (2025-10-16)
------------------

* Added the `calc_ireq()` function implementing the ISO 11079 Required Clothing Insulation (IREQ) model.
* The model estimates required clothing insulation for both minimum (`IREQ_min`) and neutral (`IREQ_neutral`) thermal balance conditions, as well as Duration Limited Exposure (DLE) limits.
* The function supports scalar and vectorized numpy array inputs, automatic broadcasting, and full input validation (type, shape, and physical range checks).
* Added comprehensive unit tests (`test_ireq.py`) covering scalar, array, broadcasting, invalid, and edge-case inputs.
* Added validation cases from ISO 11079 Table F.1 for deterministic reference comparison.
* Added `IREQ` dataclass to standardize model outputs and documentation under `docs/documentation/models.rst`.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Changelog missing note about PHS field changes introduced in this PR.

This PR also alters PHS outputs (replaces 3.6.0’s sweat_* fields with water_loss_*), which is a breaking surface change relative to 3.6.x. Please add an explicit bullet under 3.7.0 with migration guidance, or revert the PHS change for a non‑breaking release.

I can propose the wording once the intended direction is confirmed.

🤖 Prompt for AI Agents
In CHANGELOG.rst around lines 4 to 13, the release notes for 3.7.0 omit mention
of the breaking PHS output change (replacing sweat_* fields with water_loss_*);
add an explicit bullet under the 3.7.0 section describing the change, mark it as
breaking, and include brief migration guidance (map old sweat_* names to new
water_loss_* names and note any semantic or unit differences), or alternatively
note that the PHS change was reverted if you choose a non‑breaking release;
update the changelog language to be concise and prescriptive for users upgrading
from 3.6.x.

@FedericoTartarini
Copy link
Collaborator

FedericoTartarini commented Oct 28, 2025

@LianqiWang111 as explained in the documentation the pull request should not be made to master but to development instead. I fixed that.

Could you also please also address all the open comments from coderabbit? There are many things that need to be fixed. I am also tagging @KristinaM93 who will also review your code.

@FedericoTartarini FedericoTartarini changed the base branch from master to development October 28, 2025 05:56
…BuiltEnvironment/development

development
Copy link

@KristinaM93 KristinaM93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some suggestions for test_ireg.py

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57a0777 and 7d50e29.

📒 Files selected for processing (5)
  • CHANGELOG.rst (1 hunks)
  • pythermalcomfort/classes_input.py (4 hunks)
  • pythermalcomfort/classes_return.py (2 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
  • tests/test_ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
tests/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

tests/**/*.py: Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)
Use numpy.testing or pytest.approx for numeric assertions
Ensure tests are deterministic, small, and pass locally with pytest before PR

Files:

  • tests/test_ireq.py
CHANGELOG.*

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update the CHANGELOG for public API changes

Files:

  • CHANGELOG.rst
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
pythermalcomfort/classes_input.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Files:

  • pythermalcomfort/classes_input.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to tests/**/*.py : Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)

Applied to files:

  • tests/test_ireq.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages

Applied to files:

  • tests/test_ireq.py
  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate domains before logs/roots (arguments must be > 0)

Applied to files:

  • tests/test_ireq.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility

Applied to files:

  • tests/test_ireq.py
  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • CHANGELOG.rst
  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • CHANGELOG.rst
  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • CHANGELOG.rst
  • pythermalcomfort/classes_input.py
  • pythermalcomfort/classes_return.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in __post_init__

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use type hints and NumPy-style docstrings for all library code

Applied to files:

  • pythermalcomfort/classes_return.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Applied to files:

  • pythermalcomfort/classes_return.py
🧬 Code graph analysis (2)
tests/test_ireq.py (1)
pythermalcomfort/models/ireq.py (1)
  • calc_ireq (6-177)
pythermalcomfort/models/ireq.py (1)
pythermalcomfort/classes_return.py (1)
  • IREQ (1049-1074)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d50e29 and 365a021.

📒 Files selected for processing (2)
  • pythermalcomfort/classes_input.py (5 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
pythermalcomfort/classes_input.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Files:

  • pythermalcomfort/classes_input.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
🧠 Learnings (11)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in __post_init__

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to tests/**/*.py : Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate domains before logs/roots (arguments must be > 0)

Applied to files:

  • pythermalcomfort/models/ireq.py
🧬 Code graph analysis (1)
pythermalcomfort/models/ireq.py (1)
pythermalcomfort/classes_return.py (1)
  • IREQ (1049-1074)
🔇 Additional comments (7)
pythermalcomfort/models/ireq.py (4)

1-4: LGTM! Imports are clean.

The imports are minimal and appropriate. Past issues with unused pandas and IREQInputs imports have been properly addressed.


6-177: LGTM! Well-structured function with comprehensive documentation.

The function follows best practices:

  • Proper type hints for all parameters
  • Comprehensive NumPy-style docstring including applicability limits (ISO 11079:2007)
  • Runnable examples demonstrating both scalar and vectorized usage
  • Input normalisation with np.asarray for vectorised operations
  • Clean delegation to helper functions

179-250: LGTM! Comprehensive input validation.

The validation functions properly enforce:

  • Broadcasting compatibility via np.broadcast_shapes (addresses past review)
  • Finite values across all inputs (addresses past review)
  • Log-domain safety for p_air > 0 (addresses past review)
  • Physical constraints appropriate for ISO 11079 cold stress evaluation

All validation checks have clear, specific error messages as per coding guidelines.


252-308: LGTM! Clean, single-purpose helper functions.

All helpers follow coding guidelines:

  • Small, focused functions with clear purposes
  • Fully vectorised numpy operations
  • Proper handling of numerical edge cases (e.g., division-by-zero guard in _calculate_heat_transfer_coefficients)
pythermalcomfort/classes_input.py (3)

6-6: LGTM! Import issue resolved.

Optional has been properly added to the typing imports, addressing the previous critical issue that would have caused a NameError at class definition time.


42-42: LGTM! New fields properly integrated into BaseInputs.

The new fields (duration, t_re, t_sk) are correctly declared with appropriate metadata for type validation. This extends the base input surface cleanly for time-referenced temperature inputs.

Also applies to: 114-122


845-951: LGTM! Exemplary input validation implementation.

The RidgeRegressionInputs class demonstrates excellent adherence to coding guidelines:

  • Calls super().__post_init__() before custom validation
  • Comprehensive finite value checks with clear error messages
  • Broadcasting compatibility validation using np.broadcast_arrays
  • Mutual requirement validation for t_re and t_sk (both or neither)
  • Physical constraint enforcement (positive duration, valid rh range, positive age/height/weight)

This is a model implementation for input validation classes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 365a021 and 1d975f9.

📒 Files selected for processing (2)
  • pythermalcomfort/classes_input.py (5 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
pythermalcomfort/classes_input.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Files:

  • pythermalcomfort/classes_input.py
🧠 Learnings (12)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Place new domain model functions in pythermalcomfort/models/<name>.py

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to tests/**/*.py : Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate domains before logs/roots (arguments must be > 0)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
PR: CenterForTheBuiltEnvironment/pythermalcomfort#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in __post_init__

Applied to files:

  • pythermalcomfort/classes_input.py
🧬 Code graph analysis (1)
pythermalcomfort/models/ireq.py (1)
pythermalcomfort/classes_return.py (1)
  • IREQ (1049-1074)

…BuiltEnvironment/development

development
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
pythermalcomfort/models/ireq.py (1)

472-480: Negative DLE needs explicit failure handling.

If the solver crosses into negative durations we currently emit "more than 8", which is misleading and hides that the iteration failed. Please surface this as an error (or at least warn) and only apply the sentinel to genuinely large positive values.

-    if np.isscalar(dle_result):
-        if dle_result > 8 or dle_result < 0:
-            dle_result = "more than 8"
-    else:
-        mask = (dle_result > 8) | (dle_result < 0)
-        if np.any(mask):
-            dle_result = dle_result.astype(object)
-            dle_result[mask] = "more than 8"
+    if np.isscalar(dle_result):
+        if dle_result < 0:
+            raise RuntimeError("DLE solver returned a negative exposure time.")
+        if dle_result > 8:
+            dle_result = "more than 8"
+    else:
+        if np.any(dle_result < 0):
+            raise RuntimeError("DLE solver returned negative exposure times.")
+        mask = dle_result > 8
+        if np.any(mask):
+            dle_result = dle_result.astype(object)
+            dle_result[mask] = "more than 8"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d975f9 and 7501c85.

📒 Files selected for processing (2)
  • pythermalcomfort/classes_input.py (5 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
pythermalcomfort/classes_input.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Files:

  • pythermalcomfort/classes_input.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
🧠 Learnings (13)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in __post_init__

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/{models,utilities}.py : Ensure docstring sections include Args (with units), Returns, Raises, Examples, Applicability

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Place new domain model functions in pythermalcomfort/models/<name>.py

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to tests/**/*.py : Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate domains before logs/roots (arguments must be > 0)

Applied to files:

  • pythermalcomfort/models/ireq.py
🧬 Code graph analysis (1)
pythermalcomfort/models/ireq.py (1)
pythermalcomfort/classes_return.py (1)
  • IREQ (1049-1074)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
pythermalcomfort/models/ireq.py (1)

477-485: Reconsider negative DLE handling.

The current code checks dle_result after rounding (good), but silently converts negative DLE values to "more than 8". A negative DLE indicates the iterative solver in _solve_dle_iteration failed (likely when q_store changed sign during bisection), which is a computational error rather than a valid "long duration" result.

Consider raising a warning or exception when dle_result < 0 is detected, or at minimum document this behaviour so users understand that "more than 8" can also mean "solver failed".

     dle_result = np.round(dle * 10.0) / 10.0
     if np.isscalar(dle_result):
-        if dle_result > 8 or dle_result < 0:
+        if dle_result > 8:
+            dle_result = "more than 8"
+        elif dle_result < 0:
+            import warnings
+            warnings.warn("DLE calculation produced negative result (solver instability); returning 'more than 8'")
             dle_result = "more than 8"
     else:
-        mask = (dle_result > 8) | (dle_result < 0)
+        mask_long = dle_result > 8
+        mask_failed = dle_result < 0
+        if np.any(mask_failed):
+            import warnings
+            warnings.warn(f"DLE calculation produced {np.sum(mask_failed)} negative result(s) (solver instability)")
+        mask = mask_long | mask_failed
         if np.any(mask):
             dle_result = dle_result.astype(object)
             dle_result[mask] = "more than 8"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7501c85 and 220b34e.

📒 Files selected for processing (2)
  • pythermalcomfort/classes_input.py (5 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
pythermalcomfort/classes_input.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Files:

  • pythermalcomfort/classes_input.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in __post_init__

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/{models,utilities}.py : Ensure docstring sections include Args (with units), Returns, Raises, Examples, Applicability

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • pythermalcomfort/classes_input.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use type hints and NumPy-style docstrings for all library code

Applied to files:

  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Place new domain model functions in pythermalcomfort/models/<name>.py

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to tests/**/*.py : Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate domains before logs/roots (arguments must be > 0)

Applied to files:

  • pythermalcomfort/models/ireq.py
🧬 Code graph analysis (2)
pythermalcomfort/classes_input.py (1)
pythermalcomfort/models/jos3.py (10)
  • tdb (1403-1414)
  • tdb (1417-1418)
  • rh (1460-1462)
  • rh (1465-1466)
  • tr (1421-1423)
  • tr (1426-1427)
  • v (1469-1471)
  • v (1474-1475)
  • clo (1505-1507)
  • clo (1510-1511)
pythermalcomfort/models/ireq.py (1)
pythermalcomfort/classes_return.py (1)
  • IREQ (1049-1074)
🔇 Additional comments (8)
pythermalcomfort/models/ireq.py (4)

179-187: LGTM!

The broadcasting validation correctly uses np.broadcast_shapes to ensure all inputs can be broadcast together, following repository patterns for vectorised behaviour.


189-250: LGTM!

The range validation is comprehensive and addresses previous review concerns:

  • Finite value checks prevent NaN/Inf issues
  • Physical constraints enforced with clear error messages
  • p_air > 0 ensures log() domain validity

As per coding guidelines.


354-365: LGTM!

The final IREQ calculation correctly recomputes all dependent quantities (q_evap, q_resp, t_clothing, heat fluxes) using the converged ireq value, ensuring consistency. This addresses the previous review concern about stale intermediate values.


422-429: LGTM!

The zero guard correctly handles the edge case where q_store approaches zero by replacing it with a small non-zero value that preserves the sign. The implementation ensures 1e-10 * sign is never zero, preventing division-by-zero when computing -40.0 / q_store.

pythermalcomfort/classes_input.py (4)

6-6: LGTM!

The new fields (duration, t_re, t_sk) and the Optional import follow the repository patterns for BaseInputs. Type metadata is correctly specified for validation.

Also applies to: 42-42, 114-122


845-951: LGTM!

The RidgeRegressionInputs class demonstrates excellent validation practices:

  • Finite value checks prevent NaN/Inf issues
  • Broadcasting validation ensures input compatibility
  • Mutual requirement for t_re and t_sk is enforced
  • Physical constraints (non-negative age/height/weight, rh range) have clear error messages

As per coding guidelines and learnings.


1242-1290: LGTM!

The IREQInputs class documentation and field definitions address previous review concerns:

  • Units correctly documented (m in W/m², w_work in W/m², p_air in l/(m²·s))
  • Optional properly imported and used in type hints
  • Clear notes about unit conversion for met values

1292-1334: LGTM!

The __post_init__ validation addresses all previous review concerns:

  • Calls super().__post_init__() for base validation (no redundant pandas conversion)
  • Validates and normalises all IREQ-specific parameters with np.asarray
  • Enforces physical constraints (m > 0, w_work ≥ 0, p_air > 0, rh in [0,100], etc.)
  • Stores normalised arrays back to instance variables

As per coding guidelines and learnings.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
CHANGELOG.rst (1)

4-8: Past review comment regarding PHS breaking change documentation remains unaddressed.

A previous review noted that the 3.7.0 changelog should document breaking PHS output changes (if applicable to this release). The current 3.7.0 entry contains no such documentation or migration guidance. If PHS changes are new to or corrected in 3.7.0, add a warning section similar to the 3.6.0 entry (lines 20–40); otherwise, if PHS changes remain from 3.6.0, no additional action is needed as that version already documents them.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 220b34e and 8468981.

📒 Files selected for processing (1)
  • CHANGELOG.rst (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
CHANGELOG.*

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update the CHANGELOG for public API changes

Files:

  • CHANGELOG.rst
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
pythermalcomfort/models/ireq.py (1)

476-485: Don’t mask negative DLE values as “more than 8”.

Negative DLE means the storage equation never crossed zero and the iteration failed; rewriting that as “more than 8” tells users the exposure is safe when it’s actually undefined. Raise instead (or propagate NaNs) so downstream code can handle the failure explicitly, and only map genuinely > 8 h values to the sentinel.

-    if np.isscalar(dle_result):
-        if dle_result > 8 or dle_result < 0:
-            dle_result = "more than 8"
-    else:
-        mask = (dle_result > 8) | (dle_result < 0)
-        if np.any(mask):
-            dle_result = dle_result.astype(object)
-            dle_result[mask] = "more than 8"
+    if np.isscalar(dle_result):
+        if dle_result < 0:
+            raise ValueError("Computed DLE is negative; iteration failed to converge.")
+        if dle_result > 8:
+            dle_result = "more than 8"
+    else:
+        if np.any(dle_result < 0):
+            raise ValueError("Computed DLE contains negative values; iteration failed to converge.")
+        mask = dle_result > 8
+        if np.any(mask):
+            dle_result = dle_result.astype(object)
+            dle_result[mask] = "more than 8"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8468981 and ab084b2.

📒 Files selected for processing (6)
  • CHANGELOG.rst (1 hunks)
  • docs/documentation/models.rst (1 hunks)
  • pythermalcomfort/classes_input.py (2 hunks)
  • pythermalcomfort/classes_return.py (1 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
  • tests/test_ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
CHANGELOG.*

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update the CHANGELOG for public API changes

Files:

  • CHANGELOG.rst
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
  • pythermalcomfort/classes_input.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
pythermalcomfort/classes_input.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Files:

  • pythermalcomfort/classes_input.py
docs/**/*.rst

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

docs/**/*.rst: Add an '.. autofunction:: pythermalcomfort.models..' entry to the docs for public APIs
Update the appropriate docs reference file that aggregates API docs when adding a public function

Files:

  • docs/documentation/models.rst
tests/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

tests/**/*.py: Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)
Use numpy.testing or pytest.approx for numeric assertions
Ensure tests are deterministic, small, and pass locally with pytest before PR

Files:

  • tests/test_ireq.py
🧠 Learnings (16)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • CHANGELOG.rst
  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
  • docs/documentation/models.rst
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/{models,utilities}.py : Ensure docstring sections include Args (with units), Returns, Raises, Examples, Applicability

Applied to files:

  • CHANGELOG.rst
  • pythermalcomfort/classes_input.py
  • docs/documentation/models.rst
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • CHANGELOG.rst
  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
  • pythermalcomfort/classes_input.py
  • docs/documentation/models.rst
  • tests/test_ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Place new domain model functions in pythermalcomfort/models/<name>.py

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in __post_init__

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
  • tests/test_ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
  • tests/test_ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to tests/**/*.py : Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)

Applied to files:

  • pythermalcomfort/models/ireq.py
  • tests/test_ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate domains before logs/roots (arguments must be > 0)

Applied to files:

  • pythermalcomfort/models/ireq.py
  • tests/test_ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • pythermalcomfort/models/ireq.py
  • pythermalcomfort/classes_return.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use type hints and NumPy-style docstrings for all library code

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/classes_input.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Applied to files:

  • pythermalcomfort/classes_return.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to docs/**/*.rst : Add an '.. autofunction:: pythermalcomfort.models.<module>.<func>' entry to the docs for public APIs

Applied to files:

  • docs/documentation/models.rst
🧬 Code graph analysis (3)
pythermalcomfort/models/ireq.py (1)
pythermalcomfort/classes_return.py (1)
  • IREQ (1049-1074)
pythermalcomfort/classes_input.py (1)
pythermalcomfort/models/jos3.py (10)
  • tdb (1403-1414)
  • tdb (1417-1418)
  • tr (1421-1423)
  • tr (1426-1427)
  • v (1469-1471)
  • v (1474-1475)
  • rh (1460-1462)
  • rh (1465-1466)
  • clo (1505-1507)
  • clo (1510-1511)
tests/test_ireq.py (1)
pythermalcomfort/models/ireq.py (1)
  • calc_ireq (6-177)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab084b2 and 5856c8a.

📒 Files selected for processing (1)
  • CHANGELOG.rst (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
CHANGELOG.*

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update the CHANGELOG for public API changes

Files:

  • CHANGELOG.rst
🧠 Learnings (4)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • CHANGELOG.rst
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/{models,utilities}.py : Ensure docstring sections include Args (with units), Returns, Raises, Examples, Applicability

Applied to files:

  • CHANGELOG.rst
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • CHANGELOG.rst
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • CHANGELOG.rst

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
pythermalcomfort/classes_return.py (1)

1048-1074: Docstring prose still inconsistent with ArrayLike type hints.

Several attribute descriptions (lines 1057, 1059, 1061, 1065) still say "float or list of floats" while the type annotations correctly use npt.ArrayLike. This creates confusion since the runtime actually returns NumPy arrays for vectorised inputs. Lines 1055 and 1063 already use the correct prose ("float, list[float], or numpy.ndarray"), so the remaining fields should match that pattern for consistency.

Apply this diff to align the docstring with the type hints:

-    ireq_neutral : float or list of floats  
+    ireq_neutral : float, list[float], or numpy.ndarray
         Upper bound of required insulation [clo].
-    icl_min : float or list of floats
+    icl_min : float, list[float], or numpy.ndarray
         Lower bound of required basic clothing insulation (ISO 9920) [clo].
-    icl_neutral : float or list of floats
+    icl_neutral : float, list[float], or numpy.ndarray
         Upper bound of required basic clothing insulation (ISO 9920) [clo].
-    dle_neutral : float or list of floats or str
+    dle_neutral : float, numpy.ndarray, or str
         Upper bound of duration limited exposure [hours] (values > 8 represented as "more than 8").
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68e34bc and 665e323.

📒 Files selected for processing (2)
  • pythermalcomfort/classes_return.py (1 hunks)
  • pythermalcomfort/models/ireq.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
pythermalcomfort/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/**/*.py: Use type hints and NumPy-style docstrings for all library code
Validate inputs in dataclass post_init (call super().post_init() if inheriting BaseInputs)
Convert pandas Series to list/np.array and normalize numeric inputs with np.asarray in post_init
Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values
Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages
Use numpy operations for numerical work (e.g., np.log, np.asarray) and avoid math.log when arrays are accepted
Validate domains before logs/roots (arguments must be > 0)
Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility
Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)
Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings
Run ruff (lint/format) and docformatter; ensure code is formatted before PR
When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
pythermalcomfort/models/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

pythermalcomfort/models/*.py: Place new domain model functions in pythermalcomfort/models/.py
Include applicability limits and minimal runnable examples in model function docstrings

Files:

  • pythermalcomfort/models/ireq.py
🧠 Learnings (15)
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Follow repository patterns: dataclasses, BaseInputs metadata, validate_type, Units/Enums (Postures, WorkIntensity, Sex)

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/classes_input.py : Add or update input dataclasses in pythermalcomfort/classes_input.py (or adjacent to the function when appropriate)

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use type hints and NumPy-style docstrings for all library code

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Support vectorized behavior; use np.atleast_1d, np.broadcast_to, and check broadcast compatibility

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : When accepting arrays, ensure computations are vectorized and avoid per-element Python loops

Applied to files:

  • pythermalcomfort/classes_return.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Functions should be small, single-purpose, and include concise, runnable examples in NumPy-style docstrings

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/{models,utilities}.py : Ensure docstring sections include Args (with units), Returns, Raises, Examples, Applicability

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Include applicability limits and minimal runnable examples in model function docstrings

Applied to files:

  • pythermalcomfort/classes_return.py
  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Run ruff (lint/format) and docformatter; ensure code is formatted before PR

Applied to files:

  • pythermalcomfort/classes_return.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/models/*.py : Place new domain model functions in pythermalcomfort/models/<name>.py

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Enforce physical constraints in validation (e.g., non-negativity, z2>z0, z1>z0, z2>z1) with clear error messages

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate inputs in dataclass __post_init__ (call super().__post_init__() if inheriting BaseInputs)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to tests/**/*.py : Write tests covering scalars, arrays, broadcasting, and invalid inputs (TypeError/ValueError)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Validate domains before logs/roots (arguments must be > 0)

Applied to files:

  • pythermalcomfort/models/ireq.py
📚 Learning: 2025-09-15T01:23:02.859Z
Learnt from: CR
Repo: CenterForTheBuiltEnvironment/pythermalcomfort PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-15T01:23:02.859Z
Learning: Applies to pythermalcomfort/**/*.py : Use validate_type(...) for type checks; raise TypeError for wrong types and ValueError for invalid values

Applied to files:

  • pythermalcomfort/models/ireq.py
🧬 Code graph analysis (1)
pythermalcomfort/models/ireq.py (1)
pythermalcomfort/classes_return.py (1)
  • IREQ (1049-1074)
🔇 Additional comments (9)
pythermalcomfort/models/ireq.py (9)

1-16: Imports and function signature look good.

The imports are clean with no unused dependencies (pandas/IREQInputs were correctly removed in earlier commits). Type hints are present and appropriate for vectorised inputs, and the function signature clearly indicates required vs. optional parameters.


17-142: Comprehensive NumPy-style docstring with Applicability section.

The docstring properly documents the ISO 11079 model with all required sections: Parameters (with units), Returns, Raises, Examples (both scalar and vectorised), Applicability (with validated ranges), Notes, and References. Runnable examples demonstrate the expected usage patterns. Well done following the repository guidelines.

Based on learnings.


144-193: Main function body is well-structured and validates required parameters.

The function explicitly checks that tdb and tr are provided (lines 145-148), converts all inputs to NumPy arrays consistently, validates shapes and ranges through dedicated helpers, and packages results into the structured IREQ dataclass. The logic is clean with good separation of concerns.


195-203: Broadcasting validation correctly implemented.

The shape validation properly uses np.broadcast_shapes to check compatibility, allows scalars, and provides clear error messages when broadcasting fails. This follows the coding guidelines for supporting vectorised behaviour.

Based on learnings.


205-266: Comprehensive input validation with finite checks and physical constraints.

All inputs are validated for finite values (preventing NaN/Inf issues) and physical constraints matching the ISO 11079 limits. The p_air > 0 check properly guards the log() domain used later in the calculation. Error messages clearly indicate which constraint was violated.

Based on learnings.


268-324: Calculation helpers are properly vectorised and single-purpose.

All helper functions use NumPy operations for vectorised calculations (avoiding per-element loops) and serve single purposes. The _calculate_heat_transfer_coefficients function appropriately guards against division by zero (line 313). While the docstrings are minimal one-liners, this is acceptable for private utility functions.

Based on learnings.


327-383: Bisection solver for IREQ correctly implements classical algorithm with proper bounds.

The iterative solver properly initialises explicit lower (0) and upper (2.0 m²·K/W) bounds, performs classical bisection by tightening the bracket based on the residual sign, and recomputes the final energy balance with the converged ireq value. This addresses previous concerns about hard-capping the solution and using stale values.


388-447: DLE iteration solver with proper zero guard.

The iterative solver for Duration Limited Exposure (DLE) correctly guards against division by zero (lines 441-446) by replacing near-zero q_store values with a small non-zero value that preserves sign information. The guard ensures numerical stability when the heat storage rate approaches zero.


505-509: Return structure properly packages results in user-friendly units.

The function returns a well-structured dictionary with IREQ and ICL values in clo units and DLE in hours, ready for consumption by the main calc_ireq function to construct the IREQ dataclass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants