deepmodeling / deepmodeling/dpti

[Code scan] HTI range integration ignores the requested scheme

Open Beginner friendly
#128 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
42
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Source: Codex global repository scan of deepmodeling/dpti at commit b719828e7eeb571bd26411430197cd74ea78e38c.
Project: https://github.com/orgs/deepmodeling/projects/27

Problem
`integrate_range_hti(all_lambda, de, de_err, scheme=...)` accepts a `scheme` argument, but it always calls `integrate_range(..., scheme='s')`. Callers requesting trapezoidal integration still get Simpson-style integration for the main range.

Code references
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/lib/utils.py#L373
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/lib/utils.py#L413
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/lib/utils.py#L414
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/hti.py#L901
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/hti_water.py#L472

Reproduction
A simple example distinguishes the schemes:

```python
import numpy as np
from dpti.lib.utils import integrate_range_hti
x = np.array([0.0, 1.0, 2.0])
y = x * x
err = np.zeros_like(x)
print(integrate_range_hti(x, y, err, scheme='t'))
```

The trapezoidal integral should be 3.0, but the current implementation uses Simpson integration and returns 2.6666667 for the integral.

Expected result
The provided `scheme` should be forwarded to `integrate_range()`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in dpti/lib/utils.py with integrate_range_hti() and compare its call to integrate_range(); review the callers in dpti/hti.py and dpti/hti_water.py for context. Reproduce the provided three-point example with scheme='t' and confirm the result is 3.0 while preserving the existing behavior for other schemes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.