Skip to content
Snippets Groups Projects
pyDCCToolsExamplesNoteBook.ipynb 2.81 KiB
Newer Older
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from pccDccTools import dsiVector,dsiMultiVector,DsiASCICOnversion"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Creatoin of DSI vectors\n",
    "DSI sectors are created from numpy arrays with the values and uncertainties as well as strings for describing the units and quantities.\n",
    "The Units are in strings [DSI-Format](https://www.ptb.de/empir2018/fileadmin/documents/empir/SmartCom/documents_for_download/Digital_System_of_Units_D-SI_2019-11-04_UK_NPL_SmartCom.pdf)\n",
    "The Quatitiy information is a string naming the quantity.\n",
    "the keyWord argument '''uncerType''' can be one of '''['absolute','rel','relPercent','relPPM']''' we will use ''' 'relPercent' ''' to specify that the uncer values are relative to the value Vector and in percent"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [],
   "source": [
    "length=20\n",
    "magValues=np.arange(length)+1*0.5 #lets create an value vector\n",
    "magUncer=np.ones(length)*0.1 #let's create an uncer vector having the same length"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [],
   "source": [
    "magDSIVector=dsiVector(magValues,magUncer,'Magnitude', r'\\volt', uncerType=\"relPercent\")"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Magnitude in \\volt len=20 (0.5, 0.0005) (1.5, 0.0015) (2.5, 0.0025) (3.5, 0.0035)  ... (19.5, 0.0195)(18.5, 0.0185)(17.5, 0.0175)(16.5, 0.0165)\n"
     ]
    }
   ],
   "source": [
    "print(magDSIVector)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}