kripnerl / pleque Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
(!!!)
...
Function pleque.io.compass.cdb()
uses revision=1
as a default parameter value. I would propose a change to revision=-1
, i.e. the most recent revision.
Arguments:
revision=1
data in CDB are broken (cause exception when you attempt to load them) but a fixed version of the data are available in revision=2
. As a result, the original behaviour ensures that that particular discharge will always throw error, possibly misleading the user into thinking that no "fixed data" exist.pyCDB
client loads the most recent revision by default. A user then might logically expect the same behaviour from pleque
as well, since this feels as the defining property/philosophy of the CDB database itself (i.e. "last revision is always/eventually the best revision which everyone should use").Equilibrium._psi_lcfs wrongly identified in Equilibrium.find_extremes
I discovered this issue by using Equilibrium.psi_n function which returns wrong values.
I suppose there should be 9 instead of 0
attrs_pos = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17]
instead of
attrs_pos = [0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 10, 11, 13, 15, 17]
pleque/pleque/io/readgeqdsk.py
Line 78 in 4cb78cc
There is a typo in the last part of the formula, it should be f_{pol,heat}
pleque.utils.flux_expansions.effective_poloidal_heat_flux_exp_coef
https://pleque.readthedocs.io/en/latest/flux_expansion.html?highlight=flux%20expansion
https://pleque.readthedocs.io/en/latest/flux_expansion.html?highlight=flux%20expansion
is inclination angle of poloidal magnetic field and the target plane.
Replace and by between (everywhere)
Currently, Equilibrium
object loaded via pleque.io.compass.cdb()
has .shot=0
. This then causes further minor inconveniences such as the loss of this metadata when writing the equilibrium into a file, e.g. to_geqdsk()
. While I usually depend on the filename to store this metadata (shot number and time) I feel like it would be nice to have this additional backup given that this is already a feature of the eqdsk format.
Proposal for fix:
Probaly just add something like
# Accessing `sig_ref` instead of parameter `shot` should handle cases when user uses `shot=None`
eq.shot = sig_ref.record_number
added just below
Line 40 in a414deb
Proposal for further investigation:
io
options (such as cudb
) and how they handle the shot
attribute, potentially fix them as wellI had to remove the transposition to load the OMAS file in OMFIT properly. What is the correct convention?
Lines 101 to 103 in db69eef
@smartass101 @coobas
Is it possible to simply satisfy something like this:
class A:
def __init__(self, name):
if isinstance(name, str):
self.name = name
elif isinstance(name, A):
self = name
a = A('foo')
b = A(a)
Where I intend to a and b be the same objects/or copies of one object.
Thanks
Vote (thumbs up) for not supporting Python 2. (Or have you decided already? :)
class Equilibrium
asdef flux_surface(*coordinates, psi_n=None, coord_type=('psi_n'), resolution = 100, **coords):
"""
:param resolution: number of points used for generation of FluxSurface
:return FluxSurface or list of FluSurfaces generated on given coordinates.
"""
grid = False
...
Coordinates
on inputCoordinates class
as_array
into Coordinates
Coordinates
Are you sure that this will not happen?
Line 279 in a7d00f9
PyCharm gives me:
Warning:(288, 32) Local variable 'tmp2' might be referenced before assignment
Line 506 in a1f203f
While preparing export of FluxFunction objects to omas I realised this is one way how to get equilibrium data from a coordinate object is for example this:
coords._eq.tor_flux(coords)
I am not sure if the possibility or need to do this is a good Idea. I am also afraid it could lead to growing ambiguity, cyclic referencing and confusion in the module and it's using as it grows.
Please correct me if I'm wrong.
Equilibriumclass functions work with coordinates objects, e.g.:
The equilibrium object has to be passed to the coordinates upon creation and is saved as a property :
code
Isn't this kind of a cycle which could in future fire back? Another disadvantage is (as I've already mentioned) is that the user has to be either keeping both equilibrium and coordinates objects to get
some equilibrium value for the coordinates (although the equilibrium is saved in coordinates), e.g.:
equi = Equilibrium(...)
coords = equi.coordinates(...)
equi.tor_flux(coords)
`
or keep using this:
equi = Equilibrium(...)
coords = equi.coordinates(...)
coords._equi.tor_flux(coords)
`
I might be wrong disliking this and maybe this way is the correct way. But I think the structure of the whole module should be changed to avoid this. One possibility to solve this could could be by using inheritance by making the coordinates class child class of the equilibrium. What do you think?
Hello, I just cloned master and ran:
python3 -m venv testvenv
source testvenv/bin/activate
pip install -U pip
pip install -e .
pip install pytest
pytest
and got the following test failures/errors:
===================================================================================================================================================== warnings summary ======================================================================================================================================================
pleque/core/equilibrium.py:215: 5 tests with warnings
tests/compu_test.py: 1 test with warning
tests/test_2Dinterpolation.py: 6 tests with warnings
tests/test_cocos.py: 48 tests with warnings
tests/test_coordinates.py: 6 tests with warnings
tests/test_equilibria.py: 12 tests with warnings
tests/test_gfile.py: 12 tests with warnings
tests/test_io.py: 6 tests with warnings
tests/test_surface_param.py: 1 test with warning
/home/peter/Codes/pleque/pleque/core/equilibrium.py:215: DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead
pleque/core/coordinates.py:463
/home/peter/Codes/pleque/pleque/core/coordinates.py:463: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
pleque/io/metis.py:37
/home/peter/Codes/pleque/pleque/io/metis.py:37: PendingDeprecationWarning: dropping variables using `drop` will be deprecated; using drop_vars is encouraged.
testvenv/lib64/python3.7/site-packages/numpy/lib/type_check.py:277
/home/peter/Codes/pleque/testvenv/lib64/python3.7/site-packages/numpy/lib/type_check.py:277: FutureWarning: elementwise == comparison failed and returning scalar instead; this will raise an error or perform elementwise comparison in the future.
testvenv/lib64/python3.7/site-packages/omas/omas_setup.py:16
/home/peter/Codes/pleque/testvenv/lib64/python3.7/site-packages/omas/omas_setup.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
testvenv/lib64/python3.7/site-packages/omas/omas_hdc.py:9
/home/peter/Codes/pleque/testvenv/lib64/python3.7/site-packages/omas/omas_hdc.py:9: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================================================================================================================================== short test summary info ==================================================================================================================================================
FAILED tests/compu_test.py::test_compu - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/surfaces_test.py::test_surfs - assert array([], shape=(1, 0), dtype=float64) is None
FAILED tests/test_cocos.py::test_directions[5-1] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_directions[5-2] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_directions[5-3] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_directions[5-4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-1] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-2] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-3] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-6] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-7] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_coordinates_transforms[5-8] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-1] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-2] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-3] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-6] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-7] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_cocos.py::test_cocos_consistency[5-8] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_equilibria.py::test_equilibria[4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
FAILED tests/test_equilibria.py::test_equilibria[5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_gfile.py::test_calculated_profiles[5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
FAILED tests/test_surface_param.py::test_q_profiles - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
ERROR tests/test_2Dinterpolation.py::test_surfacefunction[4-data0-coord10-coord20-3-1] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
ERROR tests/test_2Dinterpolation.py::test_surfacefunction[4-data1-coord11-coord21-3-0] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
ERROR tests/test_2Dinterpolation.py::test_surfacefunction[5-data0-coord10-coord20-3-1] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
ERROR tests/test_2Dinterpolation.py::test_surfacefunction[5-data1-coord11-coord21-3-0] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
ERROR tests/test_coordinates.py::test_coordinates[4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
ERROR tests/test_coordinates.py::test_coordinates[5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
ERROR tests/test_equilibria.py::test_critical[4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
ERROR tests/test_equilibria.py::test_eq_properties[4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
ERROR tests/test_equilibria.py::test_critical[5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
ERROR tests/test_equilibria.py::test_eq_properties[5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
ERROR tests/test_gfile.py::test_from_to_gfile[4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
ERROR tests/test_gfile.py::test_from_to_gfile[5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
ERROR tests/test_io.py::test_dict2xarray[4] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 2 has size 2
ERROR tests/test_io.py::test_dict2xarray[5] - ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 0 and the array at index 1 has size 2
======================================================================================================================= 26 failed, 56 passed, 1 skipped, 102 warnings, 14 errors in 226.26s (0:03:46) =======================================================================================================================
Happy to attach the full failure log if that would be helpful!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.