Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [@sadrasabouri](https://github.com/sadrasabouri)
- [@engnadeau](https://github.com/engnadeau)
- [@grosa1](https://github.com/grosa1)
- [@maroba](https://github.com/maroba)


++ **Graphic designer**
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `Python 3.13` added to `test.yml`
- `Python 3.14` added to `test.yml`
- Restart mode updated
### Fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move these lines under the ### Changed section.

- `filter_lambda` function bug (values below 14 were set to 23)
- `get_precision` function bug with scientific notation steps
- Infinite loop with zero current step
## [1.4] - 2024-03-16
### Added
- `feature_request.yml` template
Expand Down
7 changes: 6 additions & 1 deletion opem/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ def get_precision(input_number):
:return: precision as int
"""
input_string = str(input_number)
if "e" in input_string.lower():
mantissa, exponent = input_string.lower().split("e")
return max(0, get_precision(mantissa) - int(exponent))
if "." in input_string:
splitted_input = input_string.split(".")
return len(splitted_input[1])
Expand Down Expand Up @@ -583,7 +586,7 @@ def filter_lambda(Input_Dict):
print(
"[Warning] Opem Automatically Set Lambda To Maximum Value (23) ")
elif Input_Dict["lambda"] < 14:
Input_Dict["lambda"] = 23
Input_Dict["lambda"] = 14
print(
"[Warning] Opem Automatically Set Lambda To Minimum Value (14) ")
return Input_Dict
Expand Down Expand Up @@ -739,6 +742,8 @@ def filter_range(IStart, IEnd, IStep):
:type IStep: float
:return: filtered range as list
"""
if IStep == 0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove this section

raise ValueError("[Error] Current step must not be zero")
temp = None
IStartO = IStart
IEndO = IEnd
Expand Down
12 changes: 11 additions & 1 deletion test/test_Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
0
>>> get_precision(2.55)
2
>>> get_precision(1e-05)
5
>>> get_precision(1.5e-05)
6
>>> get_precision(1e+20)
0
>>> warning_check_1(-0.2, 10, 20, True)
[True, 10]
>>> warning_check_1(-0.2, 10, 20, False)
Expand All @@ -42,7 +48,7 @@
{'alpha': 1}
>>> filter_lambda({"lambda":13})
[Warning] Opem Automatically Set Lambda To Minimum Value (14)
{'lambda': 23}
{'lambda': 14}
>>> filter_alpha({"alpha":-0.1})
[Warning] Opem Automatically Set Alpha To Maximum Value (0)
{'alpha': 0}
Expand All @@ -52,6 +58,10 @@
[0, 500, 0.1]
>>> filter_range(500,0,-0.1)
[0, 500, 0.1]
>>> filter_range(0,100,0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove this section

Traceback (most recent call last):
...
ValueError: [Error] Current step must not be zero
>>> Input_dict=Get_Input({"T": "Cell Operation Temperature [K]", "PH2": "Partial Pressure [atm]", "PO2": "Partial Pressure [atm]"},input_item=input_test)
>>> Input_keys=list(Input_dict)
>>> Input_keys.sort()
Expand Down
Loading