Feature/signal data operation#90
Conversation
…signal_data_operation # Conflicts: # backend/ibex/endpoints/schemas/request_data_schemas.py
…nto feature/signal_data_operation # Conflicts: # backend/ibex/data_source/imas_python_source_utils.py
…re/signal_data_operation # Conflicts: # backend/ibex/core/data_manipulation_methods.py # backend/ibex/data_source/imas_python_source.py # backend/ibex/data_source/imas_python_source_utils.py # backend/ibex/endpoints/schemas/request_data_schemas.py # backend/tests/conftest.py # backend/tests/test_data_endpoints.py # backend/tests/test_data_manipulation.py # docs/source/developers_manual/backend_development/data_manipulation.rst
|
|
@prasad-sawantdesai : Could you provide me info about your test files (BASE and OTHER) ? I would like to reproduce your tests using the same data you are using. |
$ echo $OTHER
imas:hdf5?path=/work/imas/shared/imasdb/ITER/3/134174/117#equilibrium/vacuum_toroidal_field/b0
$ echo $BASE
imas:hdf5?path=/work/imas/shared/imasdb/ITER/3/53299/2#equilibrium/vacuum_toroidal_field/b0 |
…ture/signal_data_operation # Conflicts: # backend/ibex/data_source/imas_python_source.py
…nto feature/signal_data_operation
| axis_indices.append(lookup[value]) | ||
|
|
||
| axis_indices = np.searchsorted(np.asarray(target), np.asarray(orig)) | ||
| target_indices.append(axis_indices) |
There was a problem hiding this comment.
Could we verify that target[indices] == orig after searchsorted and reject coordinates missing from the target grid?
import imas
import numpy as np
entries = [
("/tmp/ibex-grid-first", [0.0, 0.5, 1.0], [10.0, 20.0, 30.0]),
("/tmp/ibex-grid-second", [0.0, 0.4, 0.8], [100.0, 200.0, 300.0]),
]
for path, rho, temperature in entries:
with imas.DBEntry(f"imas:hdf5?path={path}", mode="w") as entry:
cp = entry.factory.core_profiles()
cp.ids_properties.homogeneous_time = 1
cp.time = np.array([1.0])
cp.profiles_1d.resize(1)
cp.profiles_1d[0].grid.rho_tor_norm = np.array(rho)
cp.profiles_1d[0].electrons.temperature = np.array(temperature)
entry.put(cp)
# This works correctly
curl -sS -G http://127.0.0.1:8000/data/plot_data --data-urlencode "uri=$FIRST" --data-urlencode "interpolate_over=$SECOND" --data-urlencode "interpolation_method=exact_value" --data-urlencode "signal_operations=add:$SECOND" | jq '.data | {coordinates, value}'
"value": [
[
110.0,
null,
null,
null,
null
]
]
# but this one gives wrong result seems. $SECOND coordinates 0.4 and 0.8 do not exist in $FIRST’s grid, should raise an error?
curl -sS -G http://127.0.0.1:8000/data/plot_data --data-urlencode "uri=$FIRST" --data-urlencode "interpolate_over=$FIRST" --data-urlencode "interpolation_method=exact_value" --data-urlencode "signal_operations=sub:$FIRST" --data-urlencode "signal_operations=add:$SECOND" | jq '.data | {coordinates, value}'
"value": [
[
100.0,
200.0,
300.0
]
]There was a problem hiding this comment.
Should resample_data_without_interpolation() raise an error when the exact coordinates are not found in the target grid?
Original coordinates: [0.0, 0.4, 0.8]
Data: [100.0, 200.0, 300.0]
Target coordinates: [0.0, 0.5, 1.0]
It returns: [100.0, 200.0, 300.0]
This maps the values at 0.4 and 0.8 to 0.5 and 1.0. Should it raise an error as those exact coordinates are not exists in the target grid?
066171e to
c20ea80
Compare
c20ea80 to
353af26
Compare
|
Some linting issues remain in the last version @bpalak |
|
@olivhoenen : I am aware of this. The last two things to be done to address all Prasad comments:
|
|
@olivhoenen : Actually I was aware about few issues and not 157 errors.. All my checks done from the CLI passed. Did you change ruff rules? |
|
A new Ruff version, released yesterday enables a much larger set of rules by default (413, up from 59)... |
|
ReadTheDocs failed to checkout last commit. |
rebuilt.. |
/data/plot_data/signal_operationsparameter/info/data_manipulation_methodsendpoint responseoperationsas list["operation:<URI>", "..."]e.g.["add:<uri>","mul:<uri>","div:<uri>"]addsubmuldivWaiting for #89 to be merged first