yfournier created page: get started authored by Yori Fournier's avatar Yori Fournier
# Install the template module * (Install the module mypltemplate)[https://gitlab.aip.de/yfournier/mypltemplate/wikis/get-started#install-the-module-mypltemplate]
* (Plotting some Examples)[https://gitlab.aip.de/yfournier/mypltemplate/wikis/get-started#plotting-some-examples]
# Install the module mypltemplate
> **NOTES:** STEP 3 has two version with and without an account at gitlab.aip.de > **NOTES:** STEP 3 has two version with and without an account at gitlab.aip.de
...@@ -47,61 +51,64 @@ This will execute a series of tests, they should all be successful. ...@@ -47,61 +51,64 @@ This will execute a series of tests, they should all be successful.
Now you can start to enjoy the power of `myplotlib` Now you can start to enjoy the power of `myplotlib`
# Plotting the interactively some Exemples # Plotting some Examples
---- STEP 1: launch python2.7
>$ python2.7
## STEP 1: launch python2.7
---- STEP 2: Import the module. ```
python2.7
```
>>> # IMPORT the MODULE ## STEP 2: Import the module.
>>> from mymodule import *
This imports all variables, functions and classes from "mymodule/__init__.py" ```python
# IMPORT the MODULE
from mymodule import *
```
This imports all variables, functions and classes from `mymodule/__init__.py`
---- STEP 3: Open and Access some data ## STEP 3: Open and Access some data
The template modules has some dummy data for demonstration in "mymodule/data" The template modules has some dummy data for demonstration in `mymodule/data`
This data are of two type: This data are of two type:
- some structured data set (run1.txt, run2.txt, ...) - some **structured datasets** (run1.txt, run2.txt, ...)
- some database (serie1.txt, serie2.txt) - some **database-like datasets** (serie1.txt, serie2.txt)
In python (this is a general remark) it exists two powerful objects for In python (this is a general remark) it exists two powerful objects for
storing and accessing these types of data. storing and accessing these types of data.
- for structured data sets the python dictionaries are suitable (https://docs.python.org/2/tutorial/datastructures.html#dictionaries) - for **structured datasets** the python **dictionaries** are suitable [doc](https://docs.python.org/2/tutorial/datastructures.html#dictionaries)
- for database data sets the numpy.recarray are the perfect tool (https://docs.scipy.org/doc/numpy/reference/generated/numpy.recarray.html) - for **database-like datasets** the **numpy.recarray** are the perfect tool [doc](https://docs.scipy.org/doc/numpy/reference/generated/numpy.recarray.html)
In "mymodule/myIOs" are two files containing the functions readRun, and readSeries In `mymodule/myIOs` are two files containing the functions `readRun`, and `readSeries`
- the function readRun reads a run-text-file (structured data set) and stores the information into a python dictionary. - the function `readRun` reads a run-text-file (structured data set) and stores the information into a python dictionary.
- the function readSeries reads a series-text-file (database data set) and stores the data into a numpy recarray. - the function `readSeries` reads a series-text-file (database data set) and stores the data into a numpy recarray.
Both function returns the data container of myplotlib, MyData Both function returns the data container of myplotlib, `MyData`
>>> # READ Some data ```python
>>> run1 = readRun('./mymodule/data/serie1/run1.txt') # READ Some data
run1 = readRun('./mymodule/data/serie1/run1.txt')
you can now type ```
>>> run1
it will return:
now you can now type
```python
run1
>>> <mymodule.myplotlib.myData.MyData instance at ...> >>> <mymodule.myplotlib.myData.MyData instance at ...>
```
as you can see the object run1 is an object of type MyData. The ... shows the address of these object in the memory As you can see the object `run1` is an instance of type `MyData`. The `...` shows the address of the instance in the memory.
this identifier is unique for any instance (again this is a general remark for python) This identifier is unique (again this is a general remark for python).
Now you can call
>>> run1.data['name'] Now you can access the name of the run, the vaue of input1 or the matrix of the results by simply typing:
>>> run1.data['input1'] ```python
>>> run1.data['results'] run1.data['name']
run1.data['input1']
run1.data['results']
... ...
```
---- STEP 4: Visualising some RUN data ---- STEP 4: Visualising some RUN data
... ...
......