{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "governing-drill",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:16.412251Z",
     "iopub.status.busy": "2021-02-02T15:25:16.411805Z",
     "iopub.status.idle": "2021-02-02T15:25:16.413504Z",
     "shell.execute_reply": "2021-02-02T15:25:16.413860Z"
    },
    "papermill": {
     "duration": 0.013349,
     "end_time": "2021-02-02T15:25:16.414076",
     "exception": false,
     "start_time": "2021-02-02T15:25:16.400727",
     "status": "completed"
    },
    "tags": [
     "parameters"
    ]
   },
   "outputs": [],
   "source": [
    "scwid =\"066500110010.001\" # http://odahub.io/ontology/integral#ScWID\n",
    "emin=10.\n",
    "emax=900.\n",
    "nbins=100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "civilian-crazy",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:16.429690Z",
     "iopub.status.busy": "2021-02-02T15:25:16.429244Z",
     "iopub.status.idle": "2021-02-02T15:25:16.431741Z",
     "shell.execute_reply": "2021-02-02T15:25:16.431313Z"
    },
    "papermill": {
     "duration": 0.011471,
     "end_time": "2021-02-02T15:25:16.431837",
     "exception": false,
     "start_time": "2021-02-02T15:25:16.420366",
     "status": "completed"
    },
    "tags": [
     "injected-parameters"
    ]
   },
   "outputs": [],
   "source": [
    "# Parameters\n",
    "scwid = \"166500220010.001\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "optimum-recycling",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:16.446659Z",
     "iopub.status.busy": "2021-02-02T15:25:16.446254Z",
     "iopub.status.idle": "2021-02-02T15:25:16.448012Z",
     "shell.execute_reply": "2021-02-02T15:25:16.448372Z"
    },
    "papermill": {
     "duration": 0.010736,
     "end_time": "2021-02-02T15:25:16.448485",
     "exception": false,
     "start_time": "2021-02-02T15:25:16.437749",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "if emin<0:\n",
    "    raise Exception(\"emin can not be <0! got: %lg\"%emin)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "revised-diamond",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:16.463979Z",
     "iopub.status.busy": "2021-02-02T15:25:16.463491Z",
     "iopub.status.idle": "2021-02-02T15:25:17.204747Z",
     "shell.execute_reply": "2021-02-02T15:25:17.204309Z"
    },
    "papermill": {
     "duration": 0.750623,
     "end_time": "2021-02-02T15:25:17.204847",
     "exception": false,
     "start_time": "2021-02-02T15:25:16.454224",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING:root:unable to setup logstash FileNotFoundError(2, 'No such file or directory')\n"
     ]
    }
   ],
   "source": [
    "from ftplib import FTP\n",
    "import astropy.io.fits as fits\n",
    "from io import StringIO\n",
    "import os\n",
    "from nb2workflow.workflows import WorkflowException"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "disciplinary-discharge",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:17.220263Z",
     "iopub.status.busy": "2021-02-02T15:25:17.219849Z",
     "iopub.status.idle": "2021-02-02T15:25:17.221951Z",
     "shell.execute_reply": "2021-02-02T15:25:17.221544Z"
    },
    "papermill": {
     "duration": 0.010892,
     "end_time": "2021-02-02T15:25:17.222052",
     "exception": false,
     "start_time": "2021-02-02T15:25:17.211160",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "if len(scwid) != 16:\n",
    "    raise WorkflowException(\"bad scwid: \"+scwid)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "nutritional-commission",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:17.240416Z",
     "iopub.status.busy": "2021-02-02T15:25:17.239960Z",
     "iopub.status.idle": "2021-02-02T15:25:19.519766Z",
     "shell.execute_reply": "2021-02-02T15:25:19.520116Z"
    },
    "papermill": {
     "duration": 2.291384,
     "end_time": "2021-02-02T15:25:19.520231",
     "exception": false,
     "start_time": "2021-02-02T15:25:17.228847",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "fn=\"events.fits\"\n",
    "os.system(\"wget ftp://isdcarc.unige.ch/arc/rev_3/scw/\"+scwid[:4]+\"/\"+scwid+\"/isgri_events.fits.gz -O \"+fn)\n",
    "\n",
    "os.system(\"ls -ltor\")\n",
    "\n",
    "events=fits.open(fn)[3].data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "collective-direction",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:19.536354Z",
     "iopub.status.busy": "2021-02-02T15:25:19.535645Z",
     "iopub.status.idle": "2021-02-02T15:25:20.585085Z",
     "shell.execute_reply": "2021-02-02T15:25:20.585414Z"
    },
    "papermill": {
     "duration": 1.0593,
     "end_time": "2021-02-02T15:25:20.585530",
     "exception": false,
     "start_time": "2021-02-02T15:25:19.526230",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD8CAYAAAB9y7/cAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Il7ecAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKtUlEQVR4nO3dQYic53kH8P9Th7SQGh2anGQ7cZEdolthcA65+NAGmXTjUkpqN5eCkXDAPdeFQq/p1dTgqsSIXOwYH4oWq/hmfMnBck92jakwAcsX2w3sqRBC3x4su8t215rZmdlv5pnfDwSab2a/eRZe/ffR8737TY0xAkA/vzN1AQCsh4AHaErAAzQl4AGaEvAATQl4gKa+MuWbV9Vekr1777338sMPPzxlKQBb5+233/50jPGNk56vTdgHP5vNxs2bN6cuA2CrVNXbY4zZSc8b0QA0JeABmhLwAE0Je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1X11SRPJLk+cU30Zb1xVla21rYi4KvqpSS/TPLtqrpdVU+NMX6b5Jkkryd5L8krY4x3p6yTHqw3zsq615qbjQE0tRUdPACLE/AATQl4gKYEPEBTAh6gKQEP0JSAB2hKwAM0JeABmvpf0iMvlhFWe8AAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fn=\"spec.png\"\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "plt.figure()\n",
    "h=plt.hist(events['ISGRI_ENERGY'],np.logspace(np.log10(emin),np.log10(emax),nbins),log=True)\n",
    "plt.semilogx()\n",
    "plt.savefig(fn)\n",
    "\n",
    "#Image(fn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "enclosed-inventory",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:20.602008Z",
     "iopub.status.busy": "2021-02-02T15:25:20.601546Z",
     "iopub.status.idle": "2021-02-02T15:25:20.603886Z",
     "shell.execute_reply": "2021-02-02T15:25:20.604248Z"
    },
    "papermill": {
     "duration": 0.012101,
     "end_time": "2021-02-02T15:25:20.604362",
     "exception": false,
     "start_time": "2021-02-02T15:25:20.592261",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1348841"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total_events=len(events['ISGRI_ENERGY'])\n",
    "total_events"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "persistent-worry",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:20.664081Z",
     "iopub.status.busy": "2021-02-02T15:25:20.663579Z",
     "iopub.status.idle": "2021-02-02T15:25:20.665283Z",
     "shell.execute_reply": "2021-02-02T15:25:20.665607Z"
    },
    "papermill": {
     "duration": 0.05335,
     "end_time": "2021-02-02T15:25:20.665718",
     "exception": false,
     "start_time": "2021-02-02T15:25:20.612368",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#import papermill as pm\n",
    "#import base64\n",
    "\n",
    "#pm.record(\"spectrum\",dict(filename=fn,content=base64.b64encode(open(fn).read())))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "following-asbestos",
   "metadata": {
    "papermill": {
     "duration": 0.006849,
     "end_time": "2021-02-02T15:25:20.679777",
     "exception": false,
     "start_time": "2021-02-02T15:25:20.672928",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "educational-magic",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:20.696620Z",
     "iopub.status.busy": "2021-02-02T15:25:20.696073Z",
     "iopub.status.idle": "2021-02-02T15:25:20.698873Z",
     "shell.execute_reply": "2021-02-02T15:25:20.698476Z"
    },
    "papermill": {
     "duration": 0.012451,
     "end_time": "2021-02-02T15:25:20.698970",
     "exception": false,
     "start_time": "2021-02-02T15:25:20.686519",
     "status": "completed"
    },
    "tags": [
     "outputs"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1348841"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spectrum_png = fn # http://odahub.io/ontology/preview/png\n",
    "spectrum = h[0].tolist() # http://odahub.io/ontology/preview/png\n",
    "total_events "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "academic-european",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-02-02T15:25:20.721219Z",
     "iopub.status.busy": "2021-02-02T15:25:20.720680Z",
     "iopub.status.idle": "2021-02-02T15:25:20.732892Z",
     "shell.execute_reply": "2021-02-02T15:25:20.732518Z"
    },
    "papermill": {
     "duration": 0.026724,
     "end_time": "2021-02-02T15:25:20.732991",
     "exception": false,
     "start_time": "2021-02-02T15:25:20.706267",
     "status": "completed"
    },
    "tags": [
     "injected-gather-outputs"
    ]
   },
   "outputs": [
    {
     "data": {
      "application/scrapbook.scrap.text+json": {
       "data": "spec.png",
       "encoder": "text",
       "name": "spectrum_png",
       "version": 1
      }
     },
     "metadata": {
      "scrapbook": {
       "data": true,
       "display": false,
       "name": "spectrum_png"
      }
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "application/scrapbook.scrap.text+json": {
       "data": "[encoded data, 4264 characters]",
       "encoder": "text",
       "name": "spectrum_png_content",
       "version": 1
      }
     },
     "metadata": {
      "scrapbook": {
       "data": true,
       "display": false,
       "name": "spectrum_png_content"
      }
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "application/scrapbook.scrap.json+json": {
       "data": [
        673.0,
        716.0,
        714.0,
        721.0,
        722.0,
        761.0,
        797.0,
        918.0,
        1223.0,
        1417.0,
        1599.0,
        1757.0,
        2041.0,
        1948.0,
        2058.0,
        2114.0,
        2304.0,
        2741.0,
        3475.0,
        4777.0,
        6700.0,
        8707.0,
        11485.0,
        13849.0,
        15574.0,
        17107.0,
        17169.0,
        17348.0,
        16319.0,
        16027.0,
        14966.0,
        14292.0,
        13523.0,
        13072.0,
        13083.0,
        12971.0,
        13472.0,
        13398.0,
        14253.0,
        15652.0,
        17295.0,
        20059.0,
        22353.0,
        25991.0,
        26560.0,
        25068.0,
        25738.0,
        26557.0,
        29424.0,
        33116.0,
        31748.0,
        31190.0,
        28595.0,
        26431.0,
        23619.0,
        21519.0,
        19991.0,
        19320.0,
        18551.0,
        18692.0,
        19473.0,
        20375.0,
        20700.0,
        21049.0,
        20456.0,
        19565.0,
        19402.0,
        19044.0,
        18598.0,
        17821.0,
        17143.0,
        16485.0,
        15811.0,
        14750.0,
        14356.0,
        13148.0,
        13043.0,
        12468.0,
        11893.0,
        11550.0,
        10777.0,
        10236.0,
        9871.0,
        9144.0,
        8568.0,
        8455.0,
        8617.0,
        8699.0,
        8315.0,
        7165.0,
        6635.0,
        6267.0,
        5931.0,
        5528.0,
        5233.0,
        5190.0,
        5009.0,
        4797.0,
        4688.0
       ],
       "encoder": "json",
       "name": "spectrum",
       "version": 1
      }
     },
     "metadata": {
      "scrapbook": {
       "data": true,
       "display": false,
       "name": "spectrum"
      }
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "application/scrapbook.scrap.json+json": {
       "data": 1348841,
       "encoder": "json",
       "name": "total_events",
       "version": 1
      }
     },
     "metadata": {
      "scrapbook": {
       "data": true,
       "display": false,
       "name": "total_events"
      }
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "import papermill as pm\n",
    "import scrapbook as sb\n",
    "import base64\n",
    "import json\n",
    "import os\n",
    "    \n",
    "from nb2workflow.nbadapter import denumpyfy\n",
    "\n",
    "\n",
    "try:\n",
    "    sb.glue(\"spectrum_png\",denumpyfy(spectrum_png))\n",
    "except Exception as e:\n",
    "    print(\"failed to glue spectrum_png\", spectrum_png)\n",
    "    print(\"will glue jsonified\")\n",
    "    sb.glue(\"spectrum_png\",json.dumps(denumpyfy(spectrum_png)))\n",
    "\n",
    "isinstance(spectrum_png,str) and os.path.exists(spectrum_png) and sb.glue(\"spectrum_png_content\",base64.b64encode(open(spectrum_png,'rb').read()).decode())\n",
    "\n",
    "try:\n",
    "    sb.glue(\"spectrum\",denumpyfy(spectrum))\n",
    "except Exception as e:\n",
    "    print(\"failed to glue spectrum\", spectrum)\n",
    "    print(\"will glue jsonified\")\n",
    "    sb.glue(\"spectrum\",json.dumps(denumpyfy(spectrum)))\n",
    "\n",
    "isinstance(spectrum,str) and os.path.exists(spectrum) and sb.glue(\"spectrum_content\",base64.b64encode(open(spectrum,'rb').read()).decode())\n",
    "\n",
    "try:\n",
    "    sb.glue(\"total_events\",denumpyfy(total_events))\n",
    "except Exception as e:\n",
    "    print(\"failed to glue total_events\", total_events)\n",
    "    print(\"will glue jsonified\")\n",
    "    sb.glue(\"total_events\",json.dumps(denumpyfy(total_events)))\n",
    "\n",
    "isinstance(total_events,str) and os.path.exists(total_events) and sb.glue(\"total_events_content\",base64.b64encode(open(total_events,'rb').read()).decode())\n"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  },
  "papermill": {
   "default_parameters": {},
   "duration": 5.696047,
   "end_time": "2021-02-02T15:25:21.148575",
   "environment_variables": {},
   "exception": null,
   "input_path": "/tmp/nb2w-v7h85vcw/workflow-notebook_preproc.ipynb",
   "output_path": "/tmp/nb2w-v7h85vcw/workflow-notebook_output.ipynb",
   "parameters": {
    "scwid": "166500220010.001"
   },
   "start_time": "2021-02-02T15:25:15.452528",
   "version": "2.3.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}