tag:blogger.com,1999:blog-137103362024-03-07T23:18:35.904-05:00NeurochannelsNeuroscience, coding, and neural codingEric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.comBlogger90125tag:blogger.com,1999:blog-13710336.post-49926576493004612092020-03-18T11:34:00.006-04:002020-03-19T14:32:59.811-04:00Great new PyQt bookIt's been a while since I did any GUI coding in Python, so I thought I'd clear out the cobwebs with Mastering GUI Programming with Python by Alan Moore. I was very pleasantly surprised. It covers PyQt5 from the ground up.
This book is fantastic, and the first proper successor to the previous go-to book on learning this stuff: Summerfield's 2008 book on PyQt 4, which I read cover to cover about 6Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-42494827340755898252019-09-20T23:52:00.004-04:002019-09-20T23:55:57.920-04:00Creating and consuming tensorflow record files
TFRecord files can be confusing. They are the preferred data containers for training tensorflow models when using the object detection api (github).
It took me a while to converge on code I like for generating TFRecord files (including hard negative examples, with no bounding boxes), and for consuming TFRecord files to display their contents. The latter is especially important, as when you Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com2tag:blogger.com,1999:blog-13710336.post-17120586932255836292019-02-17T01:12:00.001-05:002019-05-28T11:27:53.928-04:00Installing the NEST simulator for use with AnacondaInstalling the NEST simulator for use with Anaconda was pretty painless. However, it took me two failed tries to realize just how painless, so I thought I'd post how I got it working.
Note I am in Ubuntu 16/Python 3.7/Conda 4.5.11. If you are on Windows, don't even bother. Just install Linux.
Edit:
Note since I posted this, someone has created an installer that should make installation Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com4tag:blogger.com,1999:blog-13710336.post-30624586842386870372018-04-20T09:50:00.002-04:002018-04-20T09:51:44.238-04:00Systems Neuroscience Highlights: March 2018I'll be doing monthly summaries again, but this time over at philosophy of brains. March 2018 is up:
http://philosophyofbrains.com/2018/04/19/systems-neuroscience-highlights-march-2018.aspxEric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-67130667580310610282017-08-06T03:42:00.002-04:002020-06-01T10:55:40.895-04:00Systems Neuroscience Highlights: June and July 2017There were lots of great articles the last couple of months, in particular a series of articles on the fly's representation of it's position in space that seem to be coming together nicely.
Sensory Coding
Singla et al.. A cerebellum-like circuit in the auditory system cancels responses to self-generated sounds -- Nature Neuroscience [Pubmed] It
is well-known that the brain is able to factor Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-27656336561266393732017-07-27T11:55:00.003-04:002017-08-06T01:35:35.076-04:00Update on systems neuro lit summary for JuneI had a grant and paper submission in the last month, so my summary had to take the back seat: I will be combining the June and July literature summaries..Lots of good stuff!Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-52320798927002297342017-06-05T23:44:00.002-04:002017-08-06T02:50:09.335-04:00Systems Neuroscience Highlights: May 2017It was a great month for systems neuroscience, and the following articles stood out as pushing things forward in unexpected (to me) and interesting ways.
Sensory CodingTien et al -- Homeostatic Plasticity Shapes Cell-Type-Specific Wiring in the Retina -- Neuron [Pubmed] This is an amazing paper.
They generated a line of mice that was lacking a certain type of Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com1tag:blogger.com,1999:blog-13710336.post-38278345731452285132017-05-05T21:59:00.003-04:002017-05-06T17:36:33.748-04:00Systems Neuroscience Highlights: April 2017Lots of great systems neuroscience this month. It was hard to narrow it down, but three papers really stood out.
Cognitive Neuroscience
Eichenbaum -- The role of the hippocampus in navigation is memory. J. Neurophys.. [Pubmed] Most of us have wondered about the relationship between the two main views of the hippocampus: on one hand, the hippocampus is key for long-term memory formation, and onEric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-54476452419299400672017-04-04T14:55:00.003-04:002017-04-05T16:42:56.517-04:00Systems Neuroscience Highlights: March 2017First post of monthly highlights from the systems neuroscience literature. My goal is to point out cool stuff that people might not ordinarily see, so I will try not to just include Nature and Science papers. I will typically highlight three to five papers a month, but this includes some February spillover so is a little longer. I will post by the fifth of each month.
Sensory Coding
Shi Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-49703998402197591952015-11-18T20:27:00.001-05:002015-11-18T20:52:52.226-05:00Matlab notes 2015Notes to myself on little tricks and tips I find useful in Matlab. 2015 version. Last time I did this it was 2013.
Exporting surf plots for Illustrator in Matlab
Exporting surf plots is a pain, one of those things that is perennially a problem in Matlab but they seem to never get around to fixing. There are a couple of quick fixes. First, this thread is helpful. Use the painters renderer and it Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-22379834619287193052015-02-10T21:24:00.002-05:002016-11-21T12:13:57.760-05:00PySide Tree Model V: Building trees with QTreeWidget and QStandardItemModel Last in a series on treebuilding in PySide: see Table of Contents.
As mentioned in post IIC, if our ultimate goal were to display a tree as simple as the one in the simpletreemodel, we would probably just use QTreeWidget or QStandardItemModel. In both cases, it is almost embarrassing how much easier it is to create the tree. This is because we don't need to roll our own model or data item Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com2tag:blogger.com,1999:blog-13710336.post-12712167917278691352015-02-09T13:37:00.003-05:002015-02-09T14:26:39.534-05:00PySide Tree Tutorial IV: What next?Part of a series on treebuilding in PySide: see Table of Contents.
We have finished going over simpletreemodel. This and the final post are effectively appendices to our discussion of that example.
You have probably noticed that model/view programming is a complex subject, probably deserving book-length treatment. Tree views are the most complex built-in views there are, and hopefully we have Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-4157843473767923642015-02-06T21:05:00.001-05:002015-03-10T09:56:32.238-04:00PySide Tree Tutorial IIID: Creating the tree with setupModelData()Part of a series on treebuilding in PySide: see Table of Contents
Recall that TreeModel uses setupModelData() to set up the initial tree structure. We provide a very brief description of its behavior here, and refer the reader to the code itself for more details (the code is in post IIIA). We begin with a text file (default.txt) that contains all the data for our tree:
Getting Started &Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-13443370728864425302015-02-04T22:04:00.001-05:002015-02-05T10:04:56.251-05:00PySide Tree Tutorial IIIC: Index and parentPart of a series on treebuilding in PySide: see Table of Contents
Now we get to the guts of the API, and what really separates our model from a table model. If we were just building a table model, subclassing QAbstractTableModel, our model would be done. Because we are subclassing QAbstractItemModel, we must provide two additional methods: index() and parent(). The view needs these methods to Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-10939078498166822282015-02-02T23:07:00.000-05:002015-02-04T21:31:38.634-05:00PySide Tree Tutorial IIIB: QAbstractItemModel's APIPart of a series on treebuilding in PySide: see Table of Contents.
In the next two posts, we will go through the methods instantiated in our model, starting now with rowCount(), columnCount(), data(), and headerData(). In the following post we will round it out with a discussion of index() and parent(), which are especially important in hierarchical models.
Let's start with rowCount().
Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-54113247619500368132015-01-31T19:51:00.002-05:002015-02-03T08:24:01.792-05:00PySide Tree Tutorial IIIA: Introducing the TreeModel classPart of a series on treebuilding in PySide: see Table of Contents.
We discussed models in abstract terms in Part I, then showed how to build a Python tree structure in Part II, and now we will look in more concrete terms how to construct our TreeModel, which is subclassed from QAbstractItemModel.
Recall from Part I that the TreeModel class instantiates the API required by the view, acting as aEric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-40715047434882659692015-01-29T13:36:00.006-05:002015-01-29T17:27:17.538-05:00PySide Tree Tutorial IID: Adding helper methods to TreeItemPart of a series on treebuilding in PySide: see Table of Contents.
In part IIB we saw how to build a tree structure out of TreeItem instances. What we didn't discuss there is that each TreeItem comes packed with additional methods that will help us construct our tree model. Most of these methods let us extract simple data from a TreeItem, such as its parent, or the text from Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-72383656563967723182015-01-27T10:55:00.002-05:002015-01-27T10:55:43.980-05:00 PySide Tree Tutorial IIC: Cross-examining simpletreemodelPart of a series on treebuilding in PySide: see Table of Contents.
In this tutorial, we are following simpletreemodel to the letter, simply trying to understand the code as given. But we should not assume that there is no room for improvement. For instance, in the code in post IIB, when initializing a TreeItem it would be helpful to add:
<!-- HTML generated using hilite.me -->
if Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com3tag:blogger.com,1999:blog-13710336.post-53874709574763181402015-01-26T08:38:00.000-05:002015-01-29T13:39:45.034-05:00PySide Tree Tutorial IIB: From TreeItem to tree structurePart of a series on treebuilding in PySide: see Table of Contents.
Recall from post IIA that the two classes we will focus on most are TreeItem and TreeModel. We'll start with TreeItem.
Each instance of TreeItem represents a node in our data tree, and we will bind multiple such items together into a hierarchical representation of all the data in our data set. As we will see, each node Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-72139554561856554662015-01-23T19:20:00.001-05:002015-01-23T22:04:27.802-05:00PySide Tree Tutorial IIA: An introduction to simpletreemodelPart of a series on treebuilding in PySide: see Table of Contents.
The simpletreemodel example that comes with PySide includes the following files:
simpletreemodel.py #the main program
simpletreemodel_rc.py #compiled resource file
default.txt #text file of data in GUI
The GUI displays a Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com4tag:blogger.com,1999:blog-13710336.post-24367465676583845892015-01-20T11:04:00.000-05:002015-01-27T15:51:13.762-05:00PySide Tree Tutorial IB: Models and Views -- The mighty indexPart of a series on treebuilding in PySide: see Table of Contents
One useful innovation in the development of the model/view
framework is the use of indexes. Indexes
are unique objects created by the model, with one index created for each separate item
of data to be displayed by the view (e.g., each box in Figure 2). They act as wrappers that contain useful information about each individual dataEric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-53864458437600098032015-01-19T01:13:00.000-05:002017-02-05T10:54:39.633-05:00PySide Tree Tutorial IA: Models and Views -- The Big PicturePart of a series on treebuilding in PySide: see Table of Contents.
By separating content from appearance, the model/view
framework takes a divide and conquer approach to GUI design. That is, the
appearance of the data on the screen, handled by the view, is managed separately from the application's interactions
with the data store. Such data wrangling is handled by the model.[1] This division ofEric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-16292031907273605162015-01-17T15:43:00.002-05:002015-02-10T21:25:54.651-05:00PySide Tree Tutorial: Introduction
I think
that I shall never see
A poem lovely as a
tree.
-Joyce Kilmer
I've written an annotated companion to the simpletreemodel example that comes with PySide/PyQt. The code builds and displays a
hierarchically organized data structure (i.e., a tree) using a model subclassed
from Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com2tag:blogger.com,1999:blog-13710336.post-24565712833841563532014-10-28T23:04:00.001-04:002014-10-29T10:47:31.105-04:00Database from Ch 19 of Teach Yourself PythonTeach Yourself Python is a really good introduction to Python--my favorite out of the three introductory books I own. Chapter 19, on using databases, references a video game database. I couldn't find the database online, so below is the code I used to make it.
# -*- coding: utf-8 -*-
'''Code to construct database from Chapter 19 of
Teach Yourself Python in 24 Hours by Katie Cunningham'''
Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com0tag:blogger.com,1999:blog-13710336.post-10243913762762004802014-09-20T21:56:00.002-04:002015-10-04T10:35:19.742-04:00Pyside or PyQt for beginners?As I mentioned in the previous post, my hobby recently has been porting Summerfield's book from PyQt to PySide (the code is in the PySide Summer repository).
Now that I'm about halfway through done with the translation process, I have inexorably been pulled to favor PyQt over PySide, at least for beginners. This is mainly because it has a more active community working hard to maintain the code, Eric Thomsonhttp://www.blogger.com/profile/06847717704454032165noreply@blogger.com4