{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Write/read SIDpy Dataset via pyNSID\n", "\n", "*Author: Maxim Ziatdinov*\n", "\n", "*Date: September 2020*\n", "\n", "update: \n", "- *Gerd Duscher 01/2021 (compatibility to pyNSID version 0.0.2)*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A fast introduction into how to write SIDpy datasets to NSID formatted HDF5 files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Start with standard imports:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Ensure python 3 compatibility:\n", "from __future__ import (absolute_import, division, print_function,\n", " unicode_literals)\n", "\n", "import warnings\n", "\n", "import h5py\n", "import matplotlib.pylab as plt\n", "import numpy as np\n", "\n", "# we will also need a sidpy package\n", "try:\n", " import sidpy\n", "except ModuleNotFoundError:\n", " !pip3 install sidpy\n", " import sidpy\n", "\n", "import pyNSID\n", "\n", "warnings.filterwarnings(\"ignore\", module=\"numpy.core.fromnumeric\")\n", "warnings.filterwarnings(\"ignore\", module=\"pyNSID.io.nsi_reader\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating sidpy.Dataset object(s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's create a simple sidpy Dataset from a numpy array:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n",
"
| \n",
"\n", "\n", " | \n", "
\n",
"
| \n",
"\n", "\n", " | \n", "