ansys / ansys/pyhps

sort uses absolute value

Open
#407 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5
Forks
1
Avg merge
1d 21h
Merged PRs (30d)
9

Description

### 🔍 Before submitting the issue

- [X] I have searched among the existing issues
- [X] I am using a Python virtual environment

### 🐞 Description of the bug

sorting of jobs by values of parameters appears to be a sort of the absolute value of the parameter

### 📝 Steps to reproduce

run the mapdl tyre performance example

then run
```
from ansys.hps.client import Client, ProjectApi, JmsApi

cl = Client(url="https://localhost:8443/hps", username="repadmin", password="repadmin")
project = JmsApi(cl).get_project_by_name("Mapdl Tyre Performance")
api = ProjectApi(cl, project.id)

jobs = api.get_jobs(sort=["values.camber_angle"])

for job in jobs:
print(f"camber_angle={job.values.get('camber_angle')}")
```

I see the result:
```
camber_angle=-0.6210272318289807
camber_angle=-1.5805662839207688
camber_angle=-3.1016291869012953
camber_angle=-3.249789124629034
camber_angle=-4.319690094308141
camber_angle=4.711344868950986
camber_angle=5.9100341893208554
camber_angle=-6.908193726448891
camber_angle=6.94445083678146
camber_angle=-7.957747421556585
```
The HPS server is running in WSL with the client and product running in native windows.

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

ansys hps client == 0.8.0
mapdl is 24r1
![image](https://github.com/ansys/pyhps/assets/38562795/ab4c8edd-b0d6-461f-830a-f1366ead737d)

### 🐍 Which Python version are you using?

3.10

### 📦 Installed packages

```shell
annotated-types==0.6.0
ansys-hps-client==0.8.0
ansys-pyhps==0.6.0
backoff==2.2.1
certifi==2024.2.2
charset-normalizer==3.3.2
ecdsa==0.18.0
idna==3.6
# Editable install with no version control (mapdl-tyre-performance==0.1.0)
-e c:\ansysdev\mapdl_tyre_performance
marshmallow==3.21.1
marshmallow-oneofschema==3.1.1
packaging==24.0
pyasn1==0.6.0
pydantic==2.6.4
pydantic_core==2.16.3
PyJWT==2.8.0
python-jose==3.3.0
python-keycloak==2.12.0
requests==2.31.0
requests-toolbelt==0.9.1
rsa==4.9
six==1.16.0
typing_extensions==4.10.0
urllib3==1.26.18
```

Contributor guide

Open the contributing guide

Research direction

Start at ProjectApi.get_jobs with the sort=["values.camber_angle"] reproduction against the Mapdl Tyre Performance example. Trace how the client requests or processes sorting, then verify that negative and positive camber values are ordered by their numeric values rather than absolute values; done means the reproduced results are correctly ordered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.