This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Python.h> | |
#include <math.h> | |
#include <stdexcept> | |
#include <cstdio> | |
#include <numpy/arrayobject.h> | |
template<typename T> | |
void object_to_numpy1d_nocopy(T* &ptr, PyObject* obj, long long &count, int& stride=stride_default, int type=NPY_DOUBLE) { | |
if(obj == NULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'breddels' | |
""" | |
Demonstrates combining Qt and tornado, both which want to have their own event loop. | |
The solution is to run tornado in a thread, the issue is that callbacks will then also be executed in this thread, and Qt doesn't like that. | |
To fix this, I show how to use execute the callback in the main thread, using a Qt signal/event in combination with Promises. | |
The output of the program is: | |
fetch page, we are in thread <_MainThread(MainThread, started 47200787479520)> | |
response is 191548 bytes, we are in thread <Thread(Thread-1, started daemon 47201018689280)> | |
the other thread should fulfil the result to this promise, we are in thread <Thread(Thread-1, started daemon 47201018689280)> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
from IPython.display import display | |
import ipywidgets as widgets | |
import time | |
def get_ioloop(): | |
import IPython, zmq | |
ipython = IPython.get_ipython() | |
if ipython and hasattr(ipython, 'kernel'): | |
return zmq.eventloop.ioloop.IOLoop.instance() | |
ioloop = get_ioloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Workshop NL Gaia\n", | |
" * Desktop:\n", | |
" * module load anaconda # or anaconda3\n", | |
" * source ~breddels/src/vaex/vaex.sh/.csh\n", |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer