Commit f51d1499 authored by Christian Schneider's avatar Christian Schneider
Browse files

Documentation for DataModule

parent af47ea38
......@@ -89,19 +89,21 @@ class data_grid(data_module_base):
@property
def z(self):
"""Default for two dim grid: Return values"""
return np.array(self.df.values)
return np.array(self.df.values)[self.x_min:self.x_max,
self.y_min:self.y_max]
@z.setter
def z(self, values):
self.df.values = values
self.df.values[self.x_min:self.x_max, self.y_min:self.y_max] = values
@property
def values(self):
return np.array(self.df.values)
return np.array(self.df.values)[self.x_min:self.x_max,
self.y_min:self.y_max]
@values.setter
def values(self, values):
self.df.values = values
self.df.values[self.x_min:self.x_max, self.y_min:self.y_max] = values
def rename_x(self, new_name):
self.df = self.df.rename({self.name_x: new_name})
......
......@@ -122,6 +122,11 @@ def delete_device(id, user):
# Redirect to user
return redirect(url_for('devices', user=user))
# DataModule ###################################################################
@app.route('/DataModule/')
def data_module():
return app.send_static_file('static/DataModule/index.html')
################################################################################
# Cryostats ####################################################################
# Temperature Plot #############################################################
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DataModule.plot_style &mdash; DataModule 3.1.0 documentation</title>
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<script src="../../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../../index.html" class="icon icon-home"> DataModule
</a>
<div class="version">
3.1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../datamodule.html">DataModule</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">DataModule</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html">Docs</a> &raquo;</li>
<li><a href="../index.html">Module code</a> &raquo;</li>
<li>DataModule.plot_style</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Source code for DataModule.plot_style</h1><div class="highlight"><pre>
<span></span><span class="ch">#!/usr/bin/python</span>
<span class="sd">&quot;&quot;&quot;This file contains a normalized plot style for our group.&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="kn">import</span> <span class="nn">builtins</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="c1"># Colorscheme taken from http://colorbrewer2.org/</span>
<span class="c1">#color_scheme = [&#39;#377EB8&#39;, &#39;#E41A1C&#39;, &#39;#4DAF4A&#39;, &#39;#984EA3&#39;, &#39;#FF7F00&#39;,</span>
<span class="c1"># &#39;#FFFF33&#39;, &#39;#A65628&#39;, &#39;#F781BF&#39;, &#39;#000000&#39;]</span>
<span class="n">color_scheme</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;#0072bd&#39;</span><span class="p">,</span><span class="s1">&#39;#d95319&#39;</span><span class="p">,</span><span class="s1">&#39;#edb120&#39;</span><span class="p">,</span><span class="s1">&#39;#7e2f8e&#39;</span><span class="p">,</span><span class="s1">&#39;#77ac30&#39;</span><span class="p">,</span><span class="s1">&#39;#4dbeee&#39;</span><span class="p">,</span>
<span class="s1">&#39;#a2142f&#39;</span><span class="p">,</span> <span class="s1">&#39;#000000&#39;</span><span class="p">]</span>
<span class="c1">#color_labels = [&#39;b&#39;, &#39;r&#39;, &#39;g&#39;, &#39;p&#39;, &#39;mand&#39;, &#39;y&#39;, &#39;br&#39;, &#39;pink&#39;, &#39;k&#39;]</span>
<span class="n">color_labels</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="s1">&#39;mand&#39;</span><span class="p">,</span> <span class="s1">&#39;y&#39;</span><span class="p">,</span> <span class="s1">&#39;p&#39;</span><span class="p">,</span> <span class="s1">&#39;g&#39;</span><span class="p">,</span> <span class="s1">&#39;lb&#39;</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">,</span> <span class="s1">&#39;k&#39;</span><span class="p">]</span>
<span class="c1">#color_scheme = Colorblind8</span>
<span class="n">cc</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">color_labels</span><span class="p">,</span> <span class="n">color_scheme</span><span class="p">))</span>
<span class="n">builtins</span><span class="o">.</span><span class="n">cc</span> <span class="o">=</span> <span class="n">cc</span> <span class="c1"># Make this a global variable for easy access</span>
<div class="viewcode-block" id="set"><a class="viewcode-back" href="../../datamodule.html#DataModule.plot_style.set">[docs]</a><span class="k">def</span> <span class="nf">set</span><span class="p">(</span><span class="n">font</span><span class="o">=</span><span class="s1">&#39;Serif&#39;</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="mi">11</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mf">8.6</span><span class="p">,</span> <span class="mf">8.6</span><span class="p">),</span>
<span class="n">linewidth</span><span class="o">=</span><span class="mf">1.5</span><span class="p">,</span> <span class="n">color_scheme</span><span class="o">=</span><span class="n">color_scheme</span><span class="p">,</span>
<span class="n">color_labels</span><span class="o">=</span><span class="n">color_labels</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Function to set global plot style.</span>
<span class="sd"> Parameters</span>
<span class="sd"> -----------</span>
<span class="sd"> font : str</span>
<span class="sd"> Default font. Chose from [&#39;Sans-Serif, &#39;Serif&#39;, &#39;Times New Roman&#39;, ...]</span>
<span class="sd"> fontsize : int</span>
<span class="sd"> Fontsize. Defaults is 11</span>
<span class="sd"> figsize : list</span>
<span class="sd"> Figure size in cm. [(x_dim (cm), y_dim (cm))]. For example (8.6, 8.6)]</span>
<span class="sd"> for the default PRL single column figure.</span>
<span class="sd"> linewidth : float</span>
<span class="sd"> Default linewidth</span>
<span class="sd"> color_scheme : list</span>
<span class="sd"> Colors for plot. Default is:</span>
<span class="sd"> [[&#39;#377EB8&#39;, &#39;#E41A1C&#39;, &#39;#4DAF4A&#39;, &#39;#984EA3&#39;, &#39;#FF7F00&#39;, &#39;#FFFF33&#39;,</span>
<span class="sd"> &#39;#A65628&#39;, &#39;#F781BF&#39;]</span>
<span class="sd"> color_labels : list</span>
<span class="sd"> Abbreviations array for colors. Default is:</span>
<span class="sd"> [&#39;b&#39;, &#39;r&#39;, &#39;g&#39;, &#39;p&#39;, &#39;mand&#39;, &#39;y&#39;, &#39;br&#39;, &#39;pink&#39;]</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">params</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;font.size&#39;</span><span class="p">:</span> <span class="n">fontsize</span><span class="p">,</span>
<span class="s1">&#39;backend&#39;</span><span class="p">:</span> <span class="s1">&#39;PDF&#39;</span><span class="p">,</span>
<span class="s1">&#39;font.family&#39;</span><span class="p">:</span> <span class="n">font</span><span class="p">,</span>
<span class="s1">&#39;figure.figsize&#39;</span><span class="p">:</span> <span class="p">(</span><span class="n">figsize</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">/</span><span class="mf">2.54</span><span class="p">,</span> <span class="n">figsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">/</span><span class="mf">2.54</span><span class="p">),</span>
<span class="s1">&#39;axes.prop_cycle&#39;</span><span class="p">:</span> <span class="n">plt</span><span class="o">.</span><span class="n">cycler</span><span class="p">(</span><span class="s1">&#39;color&#39;</span><span class="p">,</span> <span class="n">color_scheme</span><span class="p">),</span>
<span class="s1">&#39;axes.formatter.useoffset&#39;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s1">&#39;lines.linewidth&#39;</span><span class="p">:</span> <span class="n">linewidth</span><span class="p">,</span>
<span class="s1">&#39;axes.axisbelow&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="c1"># Grid axis below data</span>
<span class="s1">&#39;grid.color&#39;</span><span class="p">:</span> <span class="s1">&#39;#BFBFBF&#39;</span><span class="p">,</span>
<span class="s1">&#39;grid.linestyle&#39;</span><span class="p">:</span> <span class="s1">&#39;-&#39;</span><span class="p">,</span>
<span class="s1">&#39;legend.fontsize&#39;</span><span class="p">:</span> <span class="mi">10</span>
<span class="p">}</span>
<span class="n">plt</span><span class="o">.</span><span class="n">rcParams</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">params</span><span class="p">)</span>
<span class="n">builtins</span><span class="o">.</span><span class="n">cc</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">color_labels</span><span class="p">,</span> <span class="n">color_scheme</span><span class="p">))</span></div>
<div class="viewcode-block" id="check_color"><a class="viewcode-back" href="../../datamodule.html#DataModule.plot_style.check_color">[docs]</a><span class="k">def</span> <span class="nf">check_color</span><span class="p">(</span><span class="n">style</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Help function, to check if color is part of the default colors&quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">kw</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">(</span><span class="n">cc</span><span class="o">.</span><span class="n">keys</span><span class="p">()):</span>
<span class="n">m</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">kw</span><span class="p">,</span> <span class="n">style</span><span class="p">)</span>
<span class="k">if</span> <span class="n">m</span><span class="p">:</span>
<span class="k">return</span> <span class="n">m</span><span class="o">.</span><span class="n">group</span><span class="p">()</span>
<span class="c1"># Return &#39;b&#39; if nothing has found</span>
<span class="k">return</span> <span class="s1">&#39;b&#39;</span></div>
</pre></div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2018, Christian Schneider.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'3.1.0',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
.. _datamodule:
************
DataModule
************
This is a object for storing and processing our data.
It comes with various handy functions and classes. Please chose your class
depending on your data structure.
.. automodule:: DataModule
Basic DataModule Functions
===========================
.. automodule:: DataModule.functions
:members:
DataModule Classes
===================
The `DataModule` has several classes, depending on the type of data you want to
store.
Base
-----
.. autoclass:: DataModule.data_module_base
:members:
data_table
----------
Basic class for real x, y data.
.. autoclass:: DataModule.data_table
:members:
data_complex
-------------
.. autoclass:: DataModule.data_complex
:members:
data_grid
-------------
.. autoclass:: DataModule.data_grid
:members:
fit_functions
==============
.. automodule:: DataModule.fit_functions
:members:
plotting
=========
Useful plot functions and default settings for the DataModule plots
.. automodule:: DataModule.plot_style
:members:
.. figure:: figures/logo.png
:align: center
:width: 4in
Python Repository
==================
This is the documentation of the the python libraries for devices, measurements
and data analysis of the AG Kirchmair at the IQOQI
(https://iqoqi.at/en/group-page-kirchmair).
About This Documentation
=========================
This is the documentation of the the python libraries for devices, measurements
and data analysis of the AG Kirchmair at the IQOQI
(https://iqoqiq.at/en/group-page-kirchmair).
Current Main Developers
--------------------------
- Christian Schneider <c.schneider@uibk.ac.at>
- Oscar Gargiuolo <oscar.gargiulo@uibk.ac.at>
Please contact one of us, if you found some bugs, errors or have
recommendations. Thank you!
.. toctree::
:maxdepth: 3
datamodule.rst
Indices and tables
===================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
This diff is collapsed.
.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up{height:auto;max-height:100%}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment