Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ doc/source/auto_examples/

# do not commit nose tests files
*.noseids

# no pip wheel metadata
pip-wheel-metadata/
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ deploy:
skip_cleanup: true
- provider: pypi
user: "Didou09"
distributions: "sdist bdist_wheel"
distributions: "sdist"
skip_cleanup: true
skip_existing: true
on:
tags: true
all_branches: true
Expand Down
Empty file removed Debug_JINTRACMesh.pdf
Empty file.
21 changes: 0 additions & 21 deletions Debug_JINTRACMesh.svg

This file was deleted.

60 changes: 60 additions & 0 deletions Notes_Upgrades/meetings/nov_2019.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Meeting November 2019
=====================


Agenda
------

- How to package Tofu
- pip wheel
- where to set the requirements ?
- Which testing package to use ?
- nose2
- pytest
- Travis
- platforms / matrix
- tutorials as tests ?
- matplotlib blog

Present
--------

- Didier Vezinet (@Didou09)
- Florian Lebourdais (@flothesof)
- Laura Mendoza (@lasofivec)

Summary of meeting 27/11/2019
------------------------------

- Summary of the recent problems with setuptools, travis, distribution (pypi)
**Assignee**: Laura

- Documentation problems:

- More and more users asking for doc (mostly on IMAS).
- docstring:
Didier will update docstring of main user functions
**Assignee**: Didier
- website:
- add tutorials/cases with different configurations (ITER, WEST, JET, ...) [FLORIAN]
- add tutorial for only plot_touch: different types of shading, saving/exports and plotting selected pixels for plot_touch
- add tutorial for reflexions (number and types)
- 2d radiations with ITER data (best case) or fake data -> update the tutorial called Computing a camera image with custom emissivity
- sinogram: to be added to an existing tutorial
- how to build cameras: add more comments on how to create a camera (in the 5 minutes to Tofu) what are the different parameters. Maybe separate camera 1D and camera 2D and go into details on how it works.

**Assignee**: Laura + Didier + Florian ?
Deadline: December ?

- Which tool for tests:
- pytest : it looks like transition nose to pytest will be easy (pytest support nose tests and nose functions not used). Will have to clean imports from nose.
http://doc.pytest.org/en/latest/nose.html
Assignee: Florian
Deadline: next release.

- Adding Tofu to conda-forge:
Florian proposes to add tofu to the conda-forge. For the next release ?
**Assignee**: -
Deadline: next release ?

- matplotlib blog : we will re discuss this, once the tutorial are updated and that we have more examples/images
118 changes: 0 additions & 118 deletions TODO_EndOfVisit_20181212.txt

This file was deleted.

Binary file removed XICS_mask.npz
Binary file not shown.
3 changes: 1 addition & 2 deletions examples/tutorials/tuto_plot_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
Getting started: 5 minutes tutorial for `tofu`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is a tutorial that aims to get a new user a little familiar with tofu's
structure.
This is a tutorial that aims to get a new user a little familiar with tofu's structure.
"""

# The following imports matplotlib, preferably using a
Expand Down
38 changes: 38 additions & 0 deletions examples/tutorials/tuto_plot_gallery_fusion_machines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
A gallery of Fusion Machines
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This tutorial functions as a gallery of fusion machines that can easily be loaded with `tofu`.
"""

###############################################################################
# We start by importing `tofu`.

import tofu as tf

###############################################################################
# `tofu` provides a geometry helper function that allows creating a configuration with a single call.
#
# Calling with empty arguments results in a default configuration. At the time of writing, this is ITER.
# By printing the `config` object, a text representation of its components is printed. This allows inspecting
# component names, number of sections, color or visibility.

config = tf.geom.utils.create_config()
print(config)

###############################################################################
# To get a list of all available built-in configs, one has to know some details about `tofu`.
# Configurations can either be accessed by names (ITER, WEST, JET).

print(tf.geom.utils._DCONFIG_TABLE.keys())

###############################################################################
# With that being said, let's create a gallery of the "top 3" fusion machines provided by `tofu` to accelerate
# diagnostic development.

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
for fusion_machine in ['ITER', 'WEST', 'JET']:
config = tf.geom.utils.create_config(fusion_machine)
config.plot()
69 changes: 68 additions & 1 deletion tofu/imas2tofu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"""
import warnings
import traceback
import itertools as itt

try:
try:
from tofu.imas2tofu._core import *
except Exception:
from ._core import *
del warnings, traceback
except Exception as err:
if str(err) == 'imas not available':
msg = ""
Expand All @@ -26,5 +26,72 @@
msg += "\n\n => the optional sub-package tofu.imas2tofu is not usable\n"
raise Exception(msg)


# -----------------------------------------------
# Check IMAS version vs latest available in linux modules
# -----------------------------------------------

_KEYSTR = 'IMAS/'


# extract all IMAS versions from a str returned by modules
def extractIMAS(ss, keystr=_KEYSTR):
if keystr not in ss:
raise Exception
ls = ss[ss.index(keystr):].split('\n')
ls = itt.chain.from_iterable([s.split(' ') for s in ls])
ls = [s for s in ls if keystr in s]
ls = [s[len(keystr):s.index('(')] if '(' in s else s[len(keystr):]
for s in ls]
return sorted(ls)


# Compare current and latest available IMAS versions
def check_IMAS_version(verb=True, keystr=_KEYSTR):
import subprocess

# Get currently loaded IMAS
cmd = "module list"
proc = subprocess.run(cmd, check=True, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
lcur = extractIMAS(proc.stdout.decode(), keystr=keystr)
if len(lcur) != 1:
msg = ("You seem to have no / several IMAS version loaded:\n"
+ "\t- module list: {}".format(lcur))
raise Exception(msg)

# Get all available IMAS
cmd = "module av IMAS"
proc = subprocess.run(cmd, check=True, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
lav = extractIMAS(proc.stdout.decode(), keystr=keystr)
if len(lav) == 0:
msg = "There is not available IMAS version"
raise Exception(msg)

# Compare and warn
if lcur[0] not in lav:
msg = "The current IMAS version is not available!"
raise Exception(msg)

msg = None
if lav.index(lcur[0]) != len(lav)-1:
msg = ("\nYou do not seem to be using the latest IMAS version:\n"
+ "'module list' vs 'module av IMAS' suggests:\n"
+ "\t- Current version: {}\n".format(lcur[0])
+ "\t- Latest version : {}".format(lav[-1]))
warnings.warn(msg)
return lcur[0], lav


# Try comparing and warning
try:
_, _ = check_IMAS_version(verb=True)
except Exception as err:
# This warning is an optional luxury, should not block anything
pass


__all__ = ['MultiIDSLoader', 'load_Config', 'load_Plasma2D',
'load_Cam', 'load_Data']
del warnings, traceback, itt, _KEYSTR
2 changes: 1 addition & 1 deletion tofu/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Do not edit, pipeline versioning governed by git tags!
__version__ = '1.4.2a3'
__version__ = '1.4.2a3-2-gfaeb7af'