RSSAmplifier

Blog

dragly

Sharing code and thoughts

&RSS feed ↗113 posts

Latest posts

Comparing GPU performance using Blender benchmarks

<p>If you ever need a rough estimate of the performance of one GPU versus another, I recommend checking out <a href="https:&#x2F;&#x2F;opendata.blender.org&#x2F;benchmarks&#x2F;query&#x2F;">Blender’s benchmarks<&#x2F;a>.<&#x2F;p>

Interactive Halide programs on the web

<p>I am excited that the Halide developers have announced that Halide 19 will <a href="https:&#x2F;&#x2F;github.com&#x2F;halide&#x2F;Halide&#x2F;pull&#x2F;8405">soon to be published<&#x2F;a> on PyPI. <a href="https:&#x2F;&#x2F;halide-lang.org">Halide<&#x2F;a> is a high-level image processing library with bindings in C++ and Python that we use in <a…

Axons with compartmental models in Neuronify

<p>One of the features I have been wanting to implementing in Neuronify for a long time is compartmental models. These are used to simulate features such as action potentials running down an axon:<&#x2F;p>

Neuronify 2.0

<p>I have for some time been working on a new version of Neuronify, written in Rust. The goal is to make Neuronify more suited for teaching purposes. For instance by making it easier to embed multiple simulations into a single web page. This will make Neuronify better suited to integrate into blog posts and online books.<&#x2F;p>

Adding GUI elements to Visula in Python

<p>Visula is a visualization library I’ve been working on. It is my little playground for creating performant visualizations.<&#x2F;p>

Visula in Python

<p>I got the idea the other day to see if I could get Visula wrapped in Python using PyO3. Last time I played around with PyO3 I was very impressed by how easy it was to use. And once again, making a Python wrapper with PyO3 was a lot of fun.<&#x2F;p>

NumPy-like syntax for Halide with Numlide

<p>When introducing others to Halide in Python there is one common feedback I often get: While it is nice to use Halide in Python instead of C++, the syntax is not familiar.<&#x2F;p>

Improved syntax in Visula

<p>Every now and then, I try to find some time to work on my little visualization library, <a href="https:&#x2F;&#x2F;github.com&#x2F;dragly&#x2F;visula">Visula<&#x2F;a>.<&#x2F;p>

Speeding up loading OpenEXR files in Python with Rust and PyO3

<p>We have lately had to read many large [OpenEXR image files][6] in Python at work. Unfortunately, the Python package [OpenEXR][4] loads these files quite slowly. A single one of our files can easily take more than a minute to open. Other software, such as the image viewer [tev][1], loads the same files in a few seconds.<&#x2F;p>

Early steps in making a visualization library

<p>For quite some time now, I have been wanting to make a visualization library in Rust with a focus on both performance and flexibility. I want it to be a library that allows me to take continuously updated streams of data and easily turn them into the visualizations that I want. I also want the syntax to be mostly declarative so that it is easy to read the intent.<&#x2F;p>

Molecular dynamics and crystallization

<p>Back when I was writing my Master’s thesis I developed molecular dynamics simulations. These simulations have fascinated me ever since.<&#x2F;p>

Adding myelinated compartments to the neuron simulator

<p>I have now added myelinated compartments to the neuron simulator I introduced in my previous post. In addition, I increased the simulation speed and added a control for it. The original speed was a bit slow and made it tedious to follow an action potential along longer dendrites.<&#x2F;p>

Neuron simulator

<p>I have had the ambition to make a more detailed neuron simulator. Especially after getting requests for such a feature from several users of <a href="https:&#x2F;&#x2F;ovilab.net&#x2F;neuronify">Neuronify<&#x2F;a>. In particular, I have wanted to make a multicompartmental neuron model based on the <a…

Making my library&#x27;s API explicit to avoid dealing with lifetimes in Rust

<p>Recently, I wanted to read HDF5 files in Rust and WebAssembly. In particular, I was visualizing some point cloud files from the company where I work, <a href="https:&#x2F;&#x2F;zivid.com">Zivid<&#x2F;a>, in my (still very experimental) personal side project, <a href="https:&#x2F;&#x2F;github.com&#x2F;dragly&#x2F;visula">Visula<&#x2F;a>.<&#x2F;p>

Replacing Qt Quick Canvas with Shapes in Neuronify

<p>For a long time, we have been using the Qt Quick Canvas to draw the lines that indicate connections between neurons and other objects in Neuronify:<&#x2F;p>

The next version of Neuronify might be exclusively web-based

<p>Much has improved since last time I tested compiling Neuronify to WebAssembly. The latest version of Qt for WebAssembly, which comes with Qt 5.15.2, performs much better than it did about a year ago. In addition, more functionality has been added that improves the developer experience, such as support for saving and loading files asynchronously. With all of that in place, I decided to give…

Add recording to Neuronify

<p>I have just started working on adding an option to record from voltmeters and spike detectors in Neuronify.<&#x2F;p>

Structured light, part one

<p>I recently joined <a href="https:&#x2F;&#x2F;zivid.com">Zivid<&#x2F;a>, a company that creates machine vision cameras for robotics and automation. The Zivid cameras are based on a technique called structured light, where a projector and a camera are placed next to each other to shine light on and take images of objects.<&#x2F;p>

Using Rust macros to create declarative programming languages for simulations

<p>I have for some time dabbled with the what makes a good programming language for simulations. After having worked with scripts for simulation environments such as <a href="https:&#x2F;&#x2F;neuron.yale.edu&#x2F;neuron&#x2F;">NEURON<&#x2F;a>, <a href="https:&#x2F;&#x2F;www.nest-simulator.org&#x2F;">NEST<&#x2F;a> and <a href="https:&#x2F;&#x2F;briansimulator.org&#x2F;">Brian<&#x2F;a> for neural…

On closures and classes in JavaScript and TypeScript

<p>One of the great strengths of JavaScript and TypeScript is the freedom we get as developers to mix and match programming paradigms and patterns as we see fit. However, as in many other programming languages, this can also make it hard to choose among the many different options.<&#x2F;p>

Now I miss how Rust handles expressions when I am programming in other languages

<p>Recently, I have been programming in both Rust and TypeScript at the same time, which has made me very aware of which language features I miss the most when moving from one to the other.<&#x2F;p>

Container with copy-by-value semantics

<p>Recently, I have been inspired to explore the benefits of copy-by-value semantics by talks like <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=QGcVXgEVMJg">Sean Parent’s “Better Code: Runtime Polymorphism”<&#x2F;a>. This has lead me to experiment with a new container that behaves like a regular value, but still limits the number of copies made of the data it contains.<&#x2F;p>

Rust-like traits in C++

<p>As mentioned in my post on <a href="https:&#x2F;&#x2F;dragly.org&#x2F;2017&#x2F;03&#x2F;31&#x2F;uniform-call-syntax&#x2F;">uniform call syntax in C++<&#x2F;a>, I have become envious of <a href="https:&#x2F;&#x2F;blog.rust-lang.org&#x2F;2015&#x2F;05&#x2F;11&#x2F;traits.html">traits in Rust<&#x2F;a> and would like us to have something similar in C++. The great thing about traits in Rust is that…

Developing for the reMarkable tablet

<p>I got my reMarkable tablet last week, and it is great for drawing and taking notes! It almost feels like writing on paper, and I like the fact that it is a device for just that purpose. It has no web-browser, e-mail client or anything that can distract me from my work, which I find refreshing. It’s just for drawing and taking notes.<&#x2F;p>

My first post on the Qt blog about CPU usage improvements

<p>I just published my first post on the Qt blog about <a href="http:&#x2F;&#x2F;blog.qt.io&#x2F;blog&#x2F;2017&#x2F;11&#x2F;16&#x2F;cpu-usage-improvements-in-qt3d&#x2F;">CPU usage improvements in Qt 3D<&#x2F;a>. In the post, I show how the CPU usage has gone down in recent releases and some of the things we did to achieve this. In later posts, I plan to write about which memory optimizations we…

Working efficiently with multiple versions of Qt sources

<p>If you are working on the Qt source code, you likely want to compare your work with the latest stable branches for benchmarking or testing. However, once you checkout a different branch, <code>make<&#x2F;code> will often rebuild everything that you were working on. This can take a long time, making it hard to quickly compare with the latest stable build.<&#x2F;p>

Uniform call syntax in C++ today

<p>While looking into uniform call syntax in C++, I stumbled onto how some libraries use the <code>|<&#x2F;code> operator to create pipable functions. Paul Fultz II has a <a href="http:&#x2F;&#x2F;pfultz2.com&#x2F;blog&#x2F;2014&#x2F;09&#x2F;05&#x2F;pipable-functions&#x2F;">good tutorial<&#x2F;a> on how to create your own pipable functions. However, I wanted to also make existing free functions…

Using PyQt in Qt Creator

<p><a href="http:&#x2F;&#x2F;pyqt.org">PyQt<&#x2F;a> and <a href="http:&#x2F;&#x2F;pyside.org">PySide<&#x2F;a> are Python bindings for <a href="http:&#x2F;&#x2F;qt.io">Qt<&#x2F;a>. I will focus mainly on PyQt in this post, but most of what I write is also the case for PySide. Both are a common choices for adding a GUI to a Python application.<&#x2F;p>

Experimental Qt and QML in the browser

<p><strong>Update:<&#x2F;strong> You might also be interested in the <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11578317">discussion on Hacker News<&#x2F;a>.<&#x2F;p>

Using Blender and make-na to create DNA art

<p>In <a href="http:&#x2F;&#x2F;cinpla.org">CINPLA<&#x2F;a> we are developing teaching material for a new course in biology and programming. One topic we’re working on is that of bioinformatics and DNA. I figured that an artistic rendering of the DNA double helix would be nice to have and decided to try and make one in <a href="http:&#x2F;&#x2F;blender.org">Blender<&#x2F;a>. At first I considered…

An upcoming C++ library for HDF5 files

<p>I recently started working on a new C++ library for reading and writing HDF5 files. I got the idea when I was working on a few files in Python and C++ at the same time. The Python library h5py is just way more comfortable than the HDF5 C++ API. But with the new features in C++11 and C++14, I figured it should be possible to make a C++ library that is just as easy to use as h5py. And I must…

Getting started with unit tests in Qt Creator and Catch

<p>I have written about unit testing in <a href="http:&#x2F;&#x2F;qt.io">Qt Creator<&#x2F;a> on <a href="https:&#x2F;&#x2F;dragly.org&#x2F;2014&#x2F;03&#x2F;13&#x2F;new-project-structure-for-projects-in-qt-creator-with-unit-tests&#x2F;">multiple<&#x2F;a> <a href="https:&#x2F;&#x2F;dragly.org&#x2F;2013&#x2F;04&#x2F;19&#x2F;setting-up-unittest-with-qt-creator&#x2F;">occasions<&#x2F;a> earlier. Since…

Why I won&#x27;t be starting my next project in Rust

<p>I have been inspired to learn Rust and Julia lately. The idea was to use these promising languages in all of my new projects. I wanted to learn Rust because it is a safe and fast replacement for C++. I wanted to learn Julia because it is a language tailored for scientific use that might someday replace Python.<&#x2F;p>

Today I called Python from QML

<p>I always use <a href="http:&#x2F;&#x2F;doc.qt.io&#x2F;qt-5&#x2F;qtquick-index.html">QML with Qt Quick<&#x2F;a> for GUI programming. It’s incredible both for prototyping and larger applications. I find it easy to express myself in QML, because it is so flexible. It’s declarative. You can bind a button’s position to the value of a slider in just one line. Not that you’d ever want to do that, but…

Unknown title

<p>title: Straight from the source: NEURON’s incredible backwards compatibility Date: 2015-10-26 00:37 Author: svenni Tags: Straight from the source, Technical Tags: C++, hoc, neuron, neuroscience, plot, plotting, Programming, vt100, vt125 Slug: straight-from-the-source-neurons-incredible-backwards-compatibility Status: published layout: post<&#x2F;p>

Hva er nevrale nettverk? (Del 1)

<p>Kunstige nevrale nettverk er en etterligning av nervecellene våre i hjernen. De skal brukes til å gjøre datamaskiner like flinke til å lære som mennesker og dyr. Dette gjøres ved å herme etter hvordan hjernen er bygd opp.<&#x2F;p>

Nerveceller med toon-shader

<p>Da var det på tide med et nytt <a href="http:&#x2F;&#x2F;blender.org">Blender<&#x2F;a>-prosjekt igjen. Etter å ha lest om mulighetene til å lage <a href="http:&#x2F;&#x2F;www.aversionofreality.com&#x2F;blog&#x2F;2014&#x2F;3&#x2F;15&#x2F;project-maiko-understanding-cycles-toon-shaders">tegneserieaktige materialer<&#x2F;a> bestemte jeg meg for å teste dette ut på en 3D-figur av en…

Ny CINPLA-logo som helgeprosjekt

<p>Da jeg fikk jobben som stipendiat ble jeg med i en gruppe ved navn <a href="http:&#x2F;&#x2F;cinpla.org">CINPLA<&#x2F;a>. Gruppen er dannet for å kombinere eksperimenter og simuleringer innen hjerneforskning.<&#x2F;p>

Sanntid

<p>This apps shows your realtime data from all your nearest stops. Add all stops of your choice and the app will immediately fetch information about the next travels from Ruter.<&#x2F;p>

Choosing the right license for your code

<p>I was pointed to John Hunter’s <em><a href="http:&#x2F;&#x2F;nipy.sourceforge.net&#x2F;nipy&#x2F;devel&#x2F;faq&#x2F;johns_bsd_pitch.html">Why we should be using BSD<&#x2F;a><&#x2F;em> and came to think about how I rather tend to advocate using the GPL license. <a href="http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Richard_Stallman">Richard Stallman<&#x2F;a><&#x2F;p>

Simuleringer av hjernen

<p>For et par dager siden lå jeg våken i sengen og innså at dette var en av de nettene hvor jeg ikke kom til å få sove. Heldigvis sovner jeg alltids til slutt, men det går fort noen timer fra jeg legger meg til jeg faktisk sovner. Andre ganger sovner jeg umiddelbart, litt som en lysbryter som skrus av akkurat klokka 22:04.<&#x2F;p>

Installing Sumatra 0.6-dev in Ubuntu 13.10

<p><a href="http:&#x2F;&#x2F;neuralensemble.org&#x2F;sumatra&#x2F;">Sumatra<&#x2F;a> is a great tool for reproducibility and provenance when you are running numerical simulations. Keeping your work reproducible ensures that you and others will be able to check your results at a later time, while provenance is to keep track of where your results came from in the first place.<&#x2F;p>

Recent commit causes Qt3D to fail compilation

<p>A <a href="https:&#x2F;&#x2F;qt.gitorious.org&#x2F;qt&#x2F;qt3d&#x2F;commit&#x2F;5bc5eaf6886bd8187746ef8b29bacb1263c6178a">recent commit<&#x2F;a> pushed to the <a href="https:&#x2F;&#x2F;qt.gitorious.org&#x2F;qt&#x2F;qt3d&#x2F;">Qt3D repository<&#x2F;a> breaks building Qt3D against Qt version 5.2 and older with the following error message:<&#x2F;p>

New project structure for projects in Qt Creator with unit tests

<p><em><strong>Note:<&#x2F;strong> This is a new version of <a href="https:&#x2F;&#x2F;dragly.org&#x2F;2013&#x2F;04&#x2F;19&#x2F;setting-up-unittest-with-qt-creator&#x2F;">an earlier post<&#x2F;a>, with a revised project structure.<&#x2F;em><&#x2F;p>

Faster loading of Qt apps on Android

<p>*Edit: In QtCreator 3.1, the method used here (using resource files) will become the default way to perform deployment on all platforms. I.e., this guide is only useful if you have created your project using QtCreator < 3.1.<br &#x2F;> *<&#x2F;p>

Focusrite Scarlett 2i2 working flawlessly on Ubuntu with JACK

<p>I needed a new sound card for <a href="http:&#x2F;&#x2F;ubuntu.com">Ubuntu<&#x2F;a> that would allow me to do some recording and playback easily. After a bit of searching and testing, I figured I would go with the <a href="http:&#x2F;&#x2F;us.focusrite.com&#x2F;usb-audio-interfaces&#x2F;scarlett-2i2">Focusrite Scarlett 2i2<&#x2F;a>, which is a USB sound card with 2 XLR + jack inputs, stereo…

Writing molecular dynamics data to binary LAMMPS format

<p>In this post I will explain how to write to the binary <a href="http:&#x2F;&#x2F;lammps.sandia.gov&#x2F;">LAMMPS<&#x2F;a> file format from C++, using data stored in <a href="http:&#x2F;&#x2F;arma.sourceforge.net&#x2F;">Armadillo<&#x2F;a> vectors and matrices. After running the example in this post you should be able to open the resulting file in <a…

Playing around with Sculpt Mode in Blender

<p>While preparing for a presentation I’m giving on Python scripting in <a href="http:&#x2F;&#x2F;blender.org">Blender<&#x2F;a>, I figured I’d also try out some new features . One such feature is in <a href="http:&#x2F;&#x2F;wiki.blender.org&#x2F;index.php&#x2F;Doc:2.6&#x2F;Manual&#x2F;Modeling&#x2F;Meshes&#x2F;Editing&#x2F;Sculpt_Mode">Sculpt Mode<&#x2F;a>, where dynamic topology is now allowing…

Copying data files to the build directory with qmake

<p>Sometimes you want to copy some data files to the same folder as your final executable when you are building with qmake in a different directory than your source code. This is what Qt Creator does by default, so this is quite often needed.<&#x2F;p>

Multiple billboards in Qt3D

<p>While Qt3D has a transform for drawing billboards, it is not very useful if you are drawing thousands of particles. This is because the transform can only be applied to one object at the time, and using thousands of objects is never a good idea in neither OpenGL or Qt. This is simply because the overhead of each object is very large, both in terms of memory and performance.<&#x2F;p>