Skip to content

Instantly share code, notes, and snippets.

@ericdill
Last active April 6, 2016 14:23
Show Gist options
  • Save ericdill/338d1842b019eac562ab53b02b185a2d to your computer and use it in GitHub Desktop.
Save ericdill/338d1842b019eac562ab53b02b185a2d to your computer and use it in GitHub Desktop.
Untitled.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true,
"collapsed": true
},
"cell_type": "code",
"source": "from skbeam.core.accumulators.histogram import Histogram",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "cat skbeam/core/accumulators/histogram.pyx | head",
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": "\"\"\"\r\nHistogram\r\n\r\nGeneral purpose histogram classes.\r\n\"\"\"\r\ncimport cython\r\nimport numpy as np\r\ncimport numpy as np\r\nfrom ..utils import bin_edges_to_centers\r\n\r\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "binlowhigh = (5, 0, 3)\nh = Histogram(binlowhigh)",
"execution_count": 4,
"outputs": []
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "h._binsizes",
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": "array([ 0.])"
},
"metadata": {},
"execution_count": 5
}
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# After restarting the kernel and adding `from __future__ import division` in histogram.py"
},
{
"metadata": {
"trusted": true,
"collapsed": true
},
"cell_type": "code",
"source": "from skbeam.core.accumulators.histogram import Histogram",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "cat skbeam/core/accumulators/histogram.pyx | head",
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": "\"\"\"\r\nHistogram\r\n\r\nGeneral purpose histogram classes.\r\n\"\"\"\r\nfrom __future__ import division\r\ncimport cython\r\nimport numpy as np\r\ncimport numpy as np\r\nfrom ..utils import bin_edges_to_centers\r\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true,
"collapsed": true
},
"cell_type": "code",
"source": "binlowhigh = (5, 0, 3)\nh = Histogram(binlowhigh)",
"execution_count": 3,
"outputs": []
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "h._binsizes",
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": "array([ 0.6])"
},
"metadata": {},
"execution_count": 4
}
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# After commenting out `from __future__ import division` in histogram.pyx and adding # cython: language_level=3"
},
{
"metadata": {
"trusted": true,
"collapsed": true
},
"cell_type": "code",
"source": "from skbeam.core.accumulators.histogram import Histogram",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "cat skbeam/core/accumulators/histogram.pyx | head",
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": "\"\"\"\r\nHistogram\r\n\r\nGeneral purpose histogram classes.\r\n\"\"\"\r\n# cython: language_level=3\r\n# from __future__ import division\r\ncimport cython\r\nimport numpy as np\r\ncimport numpy as np\r\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true,
"collapsed": true
},
"cell_type": "code",
"source": "binlowhigh = (5, 0, 3)\nh = Histogram(binlowhigh)",
"execution_count": 3,
"outputs": []
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "h._binsizes",
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": "array([ 0.])"
},
"metadata": {},
"execution_count": 4
}
]
},
{
"metadata": {
"trusted": true,
"collapsed": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python2",
"display_name": "Python 2",
"language": "python"
},
"language_info": {
"mimetype": "text/x-python",
"nbconvert_exporter": "python",
"name": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11",
"file_extension": ".py",
"codemirror_mode": {
"version": 2,
"name": "ipython"
}
},
"gist": {
"id": "338d1842b019eac562ab53b02b185a2d",
"data": {
"description": "Untitled.ipynb",
"public": true
}
},
"_draft": {
"nbviewer_url": "https://gist.github.com/338d1842b019eac562ab53b02b185a2d"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment