Django tables2 list view does not support filtering on model properties

Which kind of sucks.  If you want to filter a column, it has to either be an aggregate function of all rows, or it has to be stored in that table or in a path from that table.  It can’t be a function of that row.  Which kind of sucks, it means that any row level functional properties have to be maintained when you do a row save.

And thus were spent 4 hours of my Sunday.

You’re welcome.


Refined photon question, posted to Stack Exchange, let’s see if it gets crushed or discarded

Posted on Stack Exchange:

Mark Andrew Smith’s PhD thesis from 1994 examines relativistic cellular automata models. Also a 1999 paper by Ostoma and Trushyck examines this topic. One topic not discussed is the information required in a cell to represent photons in transit. Suppose we have cells arrayed in a cube so that each cell has 26 neighbors. Suppose there are N cells in the simulation. So it requires \log{N} bits to represent a cell location. If a photon in motion is currently in a cell, it’s direction can be represented by the location of the farthest cell it will reach on it’s straight-line trajectory. Any cell can originate a photon and can receive photons passing through from any other cell. So each cell must be able to represent N \log{N}  bits of information, to represent all photons in transit from all possible sources.

Question: Is there any schema that could represent the set of all photons passing through a cell using less information, with reasonable fidelity?

Question: According to the Pauli Exclusion Principle, any number of photons can occupy a single point in space. In the limit (real physical space), does each point in space contain an infinite number of photons? This would require infinite bits to represent. Storage of infinite bits requires infinite energy.   If so, does this pose a challenge to the idea, expressed in Fredkin’s Digital Philosophy, that the universe is in fact a cellular automata, with the limiting speed of light simply coinciding with the “clock speed” of the automata, i.e. the rate at which photons can move from one cell to the next?

Correct reproduction of BDM

Someone attempted to reproduce BDM, had problems and posted on CodeReview StackExchange asking for insight.  The dummies there criticized the white space and variable names in his code.  I found someone’s blog post with a correct answer and posted it.  Sanctimonious and clueless lifers on the site deleted the information.  The rules of StackExchange pretty much guarantee that narrow-minded lifers, similar to Wikipedia edit patrollers, will defend StackExchange against any useful content.  Oh well.  Here’s my answer:

OP is trying to write a Python program to reproduce a claimed calculation result of Bueno De Mesquita (BDM). There is another attempt to reproduce this calculation, in Python, by David Masad, “Replicating a replication of BDM“. Masad provided Python code, and also showed an approximately 20% divergence in the median score, starting from the same example and same inputs and same references. Jeremy McKibben-Sanders then replicated the model, with results matching BDM. Masad added a new post to discuss the coding issues which led him awry. Reading those posts and their code and comparing with above code will lead to correct diagnosis for above code.


Little League baseball: Play to win or play for development

From Kindgarten through 2nd grade, my son played in Little League baseball and all players were rotated through all positions during the game, and they discouraged keeping score.   Pitching was by machine. Come 3rd grade, things change:  The emphasis is now on winning. Players are selected for particular positions that they keep throughout the season.  One or two players are selected to pitch, and no others are trained in pitching.  The coach is a former minor league player with a focus on winning. If a kid can’t bat (unless it’s the lone girl on the team), he will signal them to walk or bunt.  My son hated it, and we just dropped out.

There are two pressures on the coach:  One is parents who want to see their kid’s team win at all costs, whose kids are docile enough to accept any position.  The other (apparently a great minority) are parents like myself, who want to see their 9-year-olds having fun and learning to play all the positions in the game.

I’ve never thought about this before, but apparently it’s a matter of some debate:

Cellular automata in physics and information quantity of a cell


I was taking a look at the 1994 PhD thesis of Mark Andrew Smith on Cellular Automata Methods in Mathematical Physics.  I could only find one subsequent paper by Smith, on polymer simulation in 1999 with B. Ostrovsky.  I assume he is no longer active.  The only other work I found was some apparently self-published work by Canadian engineers in 1999, Tom Ostoma and Mike Trushyk.  Like Smith they didn’t publish anything after 1999.  It doesn’t seem to be an actively pursued field.   The only reason I could find for this lack of pursuit was a comment on the Math Stack Exchange website by Willie Wong stating that

One of the reasons that it may be difficult to model Minkowski space based on cellular automata is that there are no “non-trivial” finite sub-groups of O(3,1), where non-trivial means that it doesn’t just reduce to just a finite sub group of O(3) via conjugation. So while cellular automata can be manifestly be homogeneous and isotropic (so admits a discrete O(3) symmetry), it becomes conceptually difficult to imagine some cellular automata capturing Lorentz symmetry.

Spring reading: The Sparrow (*spoilers*)


Mary Doria Russell’s The Sparrow, like Michel Faber’s The Book of Strange New Things, is a novel which attempts to give a realistic vision of first contact with a self-aware, intelligent alien species.  This is also a novel by an author new to writing science fiction. In Faber’s case, because he comes from what is called the “literary community” (no Wikipedia definition available), and in Russell’s case, this being a first novel by an anthropologist who had only written academic articles previously.

Russell’s aliens are, in a way, much less alien than Faber’s aliens.  Both have arms and legs, are bipedal, have a language, live in houses, and have some technology.  Faber’s aliens are otherwise as different from people as squid and hamsters.  Russell’s aliens are modelled after kangaroos and tigers.

In both cases, Russell and Faber downplay and lower the drama and strangeness of first contact.  They both use the colonial analogy, like Marco Polo first meeting the Chinese or Spaniards first encountering Aztecs.  In this analogy, the presence of others is not so astonishing and is not the focus of awareness.  Rather simply the inability to recognize social cues and differences in status hierarchy.  For example imagine Meriwether Lewis running into the Kim Jong Un after walking over a hill.  The social expectations and assumptions will be quite different, and one party may behave with a level of haughtiness and indifference, despite the novelty and strangeness of the encounter, that catches the other party quite unaware.

That, in essence, is the plot of The Sparrow.  Russell’s aliens are just not as alien as Faber’s because she makes a lot of assumptions that are Earth-normative:  The atmostphere and gravity of the alien planet are not discussed and one assumes identical to Earth’s.  There are two similar species.  One turns out to be domesticated herbivore prey.  The other turn out to be carnivore predators, who look similar as a result of evolutionarily adaptive aggressive mimicry.  The herbivores are like big cuddly kittens and have very dextrous hands and are very social and warm.  The carnivores have larger teeth and three-fingered, sharp claws, and are very hierarchical and cold.  They have different kinds of intelligence, but both species are intelligent and capable of change.

The novel adopts challenge to religious faith as a theme but somewhat tiresomely overplays it.   Both the humans being social at rest in the exploration group and the humands giving each other a hard time in the Jesuit context are somewhat heavily and stereotypically written.   The construction of the dual species, and the ecological imbalance accidentally introduced by the visiting human party are cleverly designed, as one would expect of a good scientist exploring a scenario in their domain.

I bought the sequel, Children of God, which will arrive in a few weeks.  The New York Times didn’t like it.  Russell plays out the scenario a little more with a return visit.  I’m looking forward to it!  My primary takeaways from this book:

  • First contact with aliens could play out just like first contact in the human context, for example when Christian missionaries came to Japan in the 1500’s.
  • We have to be very careful about unintended ecological impact of human ideas on alien society.  The predator/prey society depicted in Russell’s book had strict population controls and no risk of prey insurrection.   The human concept of gardening interfered with population controls and the human concept of strength in numbers and retaliation upset the political stability of the dual society.
  • The aliens might not like us, find us that interesting, and may look down on us, even if they are technologically inferior, so we have to be very careful about making assumptions about social hierarchies, status, and level of empathy.  (The essence of diplomacy, I suppose.
  • Maybe we can make asteroids into self-fueling space ships.  (Her one cool and relatively unexplored technical idea.)

Finally, note the novel is written in 1998 and she has a relatively uneven scorecard as a futurologist.  She got a few things right, like tablet computing, but mostly her timeline is way too ambitious, considering it’s 2017 as I write the following conditions were supposed to hold in 2016:

  • Students do not yet become indentured servants to pay for college scholarships.
  • Japan is not the dominant economic, military and political power.
  • Asteroids are not yet so thoroughly routinely mined that you can go to a broker for a used one equipped with engines that has just the right shape.
  • Jesuits don’t commission space explorations.