From 51749d5834dd14471cf75706f22edd1d361366cd Mon Sep 17 00:00:00 2001 From: VEZINET Didier Date: Fri, 7 Feb 2020 11:36:00 +0100 Subject: [PATCH 1/4] [Issue349] Changed shortcuts reflectometer_profile --- tofu/imas2tofu/_core.py | 6 +++--- tofu/version.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index 59cae079f..6777f11a0 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -305,11 +305,11 @@ class MultiIDSLoader(object): {'t':{'str':'time'}, 'ne':{'str':'channel[chan].n_e.data', 'dim':'density', 'quant':'ne', 'units':'/m^3'}, - 'R':{'str':'channel[chan].position.r.data', + 'R':{'str':'channel[chan].position.r', 'dim':'distance', 'quant':'R', 'units':'m'}, - 'Z':{'str':'channel[chan].position.z.data', + 'Z':{'str':'channel[chan].position.z', 'dim':'distance', 'quant':'Z', 'units':'m'}, - 'phi':{'str':'channel[chan].position.phi.data', + 'phi':{'str':'channel[chan].position.phi', 'dim':'angle', 'quant':'phi', 'units':'rad'}, 'names': {'str': 'channel[chan].name'}, 'mode': {'str': 'mode'}, diff --git a/tofu/version.py b/tofu/version.py index 6c45f826f..7e86d9fee 100644 --- a/tofu/version.py +++ b/tofu/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '1.4.2b3-13-gd916732c' +__version__ = '1.4.2b4-36-ge4a11777' From a23e1c5dd09234c8f10bc53a96120c5ceaead547 Mon Sep 17 00:00:00 2001 From: VEZINET Didier Date: Fri, 7 Feb 2020 11:52:14 +0100 Subject: [PATCH 2/4] [Issue349] Small improvements to tofuplot and tofucalc to make sure they remain operational even without install --- tofu/scripts/tofucalc.py | 12 +++++++----- tofu/scripts/tofuplot.py | 12 ++++++++++-- tofu/version.py | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tofu/scripts/tofucalc.py b/tofu/scripts/tofucalc.py index 2c70cba46..660664054 100755 --- a/tofu/scripts/tofucalc.py +++ b/tofu/scripts/tofucalc.py @@ -13,8 +13,9 @@ # tofu # test if in a tofu git repo _HERE = os.path.abspath(os.path.dirname(__file__)) +_HERE = os.path.dirname(os.path.dirname(_HERE)) istofugit = False -if '.git' in _HERE and 'tofu' in _HERE: +if '.git' in os.listdir(_HERE) and 'tofu' in _HERE: istofugit = True if istofugit: @@ -28,10 +29,7 @@ from tofu.imas2tofu import MultiIDSLoader tforigin = tf.__file__ tfversion = tf.__version__ - -# if tf.__version__ < '1.4.1': - # msg = "tofuplot only works with tofu >= 1.4.1" - # raise Exception(msg) +print(tforigin, tfversion) if 'imas2tofu' not in dir(tf): msg = "imas does not seem to be available\n" @@ -169,3 +167,7 @@ def main(): # Call wrapper function call_tfcalcimas(**dict(args._get_kwargs())) + +# Add this to make sure it remains executable even without install +if __name__ == '__main__': + main() diff --git a/tofu/scripts/tofuplot.py b/tofu/scripts/tofuplot.py index ed5f580f0..571d2540d 100755 --- a/tofu/scripts/tofuplot.py +++ b/tofu/scripts/tofuplot.py @@ -13,8 +13,9 @@ # tofu # test if in a tofu git repo _HERE = os.path.abspath(os.path.dirname(__file__)) +_HERE = os.path.dirname(os.path.dirname(_HERE)) istofugit = False -if '.git' in _HERE and 'tofu' in _HERE: +if '.git' in os.listdir(_HERE) and 'tofu' in _HERE: istofugit = True if istofugit: @@ -28,7 +29,7 @@ from tofu.imas2tofu import MultiIDSLoader tforigin = tf.__file__ tfversion = tf.__version__ - +print(tforigin, tfversion) if 'imas2tofu' not in dir(tf): msg = "imas does not seem to be available\n" @@ -83,6 +84,8 @@ def call_tfloadimas(shot=None, run=_RUN, user=_USER, if t0.lower() == 'none': t0 = None + print("OK 2") # DB + tf.load_from_imas(shot=shot, run=run, user=user, tokamak=tokamak, version=version, ids=ids, indch=indch, indch_auto=indch_auto, @@ -121,6 +124,7 @@ def main(): ids: %s """%repr(_LIDS) + print("OK 1") # DB parser = argparse.ArgumentParser(description = msg) parser.add_argument('-s', '--shot', type=int, @@ -175,3 +179,7 @@ def main(): # Call wrapper function call_tfloadimas(**dict(args._get_kwargs())) + +# Add this to make sure it remains executable even without install +if __name__ == '__main__': + main() diff --git a/tofu/version.py b/tofu/version.py index 7e86d9fee..583836e02 100644 --- a/tofu/version.py +++ b/tofu/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '1.4.2b4-36-ge4a11777' +__version__ = '1.4.2b4-37-g51749d58' From 2b1aa022282207debce9e9946e3d9d3c6da9aae2 Mon Sep 17 00:00:00 2001 From: VEZINET Didier Date: Fri, 7 Feb 2020 11:55:27 +0100 Subject: [PATCH 3/4] [Issue349] Clean-up --- tofu/scripts/tofuplot.py | 3 --- tofu/version.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tofu/scripts/tofuplot.py b/tofu/scripts/tofuplot.py index 571d2540d..33d5364c5 100755 --- a/tofu/scripts/tofuplot.py +++ b/tofu/scripts/tofuplot.py @@ -84,8 +84,6 @@ def call_tfloadimas(shot=None, run=_RUN, user=_USER, if t0.lower() == 'none': t0 = None - print("OK 2") # DB - tf.load_from_imas(shot=shot, run=run, user=user, tokamak=tokamak, version=version, ids=ids, indch=indch, indch_auto=indch_auto, @@ -124,7 +122,6 @@ def main(): ids: %s """%repr(_LIDS) - print("OK 1") # DB parser = argparse.ArgumentParser(description = msg) parser.add_argument('-s', '--shot', type=int, diff --git a/tofu/version.py b/tofu/version.py index 583836e02..d854c0de3 100644 --- a/tofu/version.py +++ b/tofu/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '1.4.2b4-37-g51749d58' +__version__ = '1.4.2b4-38-ga23e1c5d' From 099b760bde4ba953205eb610c8d8325169fbd30d Mon Sep 17 00:00:00 2001 From: VEZINET Didier Date: Fri, 7 Feb 2020 11:57:10 +0100 Subject: [PATCH 4/4] [Issue349] PEP8 compliance --- tofu/imas2tofu/_core.py | 18 +++++++++--------- tofu/scripts/tofucalc.py | 1 + tofu/scripts/tofuplot.py | 1 + tofu/version.py | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index 6777f11a0..6ec5f4939 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -302,15 +302,15 @@ class MultiIDSLoader(object): 'dim':'temperature', 'quant':'Te', 'units':'eV'}}, 'reflectometer_profile': - {'t':{'str':'time'}, - 'ne':{'str':'channel[chan].n_e.data', - 'dim':'density', 'quant':'ne', 'units':'/m^3'}, - 'R':{'str':'channel[chan].position.r', - 'dim':'distance', 'quant':'R', 'units':'m'}, - 'Z':{'str':'channel[chan].position.z', - 'dim':'distance', 'quant':'Z', 'units':'m'}, - 'phi':{'str':'channel[chan].position.phi', - 'dim':'angle', 'quant':'phi', 'units':'rad'}, + {'t': {'str': 'time'}, + 'ne': {'str': 'channel[chan].n_e.data', + 'dim': 'density', 'quant': 'ne', 'units': '/m^3'}, + 'R': {'str': 'channel[chan].position.r', + 'dim': 'distance', 'quant': 'R', 'units': 'm'}, + 'Z': {'str': 'channel[chan].position.z', + 'dim': 'distance', 'quant': 'Z', 'units': 'm'}, + 'phi': {'str': 'channel[chan].position.phi', + 'dim': 'angle', 'quant': 'phi', 'units': 'rad'}, 'names': {'str': 'channel[chan].name'}, 'mode': {'str': 'mode'}, 'sweep': {'str': 'sweep_time'}}, diff --git a/tofu/scripts/tofucalc.py b/tofu/scripts/tofucalc.py index 660664054..e2394bb7d 100755 --- a/tofu/scripts/tofucalc.py +++ b/tofu/scripts/tofucalc.py @@ -168,6 +168,7 @@ def main(): # Call wrapper function call_tfcalcimas(**dict(args._get_kwargs())) + # Add this to make sure it remains executable even without install if __name__ == '__main__': main() diff --git a/tofu/scripts/tofuplot.py b/tofu/scripts/tofuplot.py index 33d5364c5..0878cfd3e 100755 --- a/tofu/scripts/tofuplot.py +++ b/tofu/scripts/tofuplot.py @@ -177,6 +177,7 @@ def main(): # Call wrapper function call_tfloadimas(**dict(args._get_kwargs())) + # Add this to make sure it remains executable even without install if __name__ == '__main__': main() diff --git a/tofu/version.py b/tofu/version.py index d854c0de3..f3fbe0706 100644 --- a/tofu/version.py +++ b/tofu/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '1.4.2b4-38-ga23e1c5d' +__version__ = '1.4.2b4-39-g2b1aa022'