Feed on Posts or Comments

Raspberry Pi &Science &Wildlife Wesley R. Elsberry on 19 May 2013

Raspberry Pi: An Update on Sound

Life has been a bit demanding lately, so it has been a while since I last worked on the Raspberry Pis. I had a notion that I might dragoon the Pis into serving as compute engines for a simulation I wrote in Python, and that got me motivated to get new Raspbian images and set up two Pis as headless units. It did not take long to disabuse me of the notion that the Pis represented a good alternative to workstation compute time: my simulation on the Pi ran at about 1/20th the speed it did on the workstation. So the simulation is running in background on the workstation, and I had two Pis hooked into the network, up and running.

So I spent a part of the weekend working on steps toward using a Pi as an acoustic monitoring platform. I bought two real-time clock (RTC) modules some time ago, so each of the Pis had one of those onboard. The critical piece of information I was missing in getting those running was that the process of establishing the Linux device corresponding to the I2C device had to be accomplished not merely using “sudo” in front of the command, but in a root-owned shell process because of redirection within the command. I found a web page that offered good advice, including putting the following lines into /etc/rc.local:

modprobe i2c-bcm2708

echo ds1307 0×68 > /sys/class/i2c-adapter/i2c-0/new_device

modprobe rtc-ds1307

hwclock -s

When we last visited this topic, I had a USB sound device that could be recognized by the RasPi and that I could take recordings from. There was just one problem: the Pi would not stably reboot with the USB sound device plugged in. Given that my use case is going to be using the system as an instrument that will only be attended maybe every two weeks or so, that problem was a sufficient discouragement to have me doing other things for a few months.

It turns out that time helps. With the most recent Raspbian image, the reboot problem has gone away. Now, everything is not completely rosy. It turns out that I needed to restrict the USB ports to USB 1.1 speed in order to get a clean recording from the mic input. That likely would interfere with using either a USB keyboard or mouse, but I was already aiming at headless operation.

This clears the way for actually getting the system put together and readied for deployment. I need to write some code to handle periodic acoustic samples (cron launching a Python script seems good to me). Having code to connect to a server to upload status updates and/or data would be good; several of the platforms have some sort of Internet service. There’s a chunk to do for hardware. I need to find out exactly what the power supply situation is. I do already have a pair of 4A 5V UBECs. I need to do some testing, though, to make sure that the UBEC does not add a significant amount of noise to acoustic recordings. Since the UBEC is a switched power regulation device, it is quite possible that power-line noise could get into recorded signals. Some sort of housing is needed. And I need to fabricate the hydrophone (a piezo disk soldered to a coax cable with some waterproof potting to cover it) and pair it with an amplifier circuit. Whatever power the amplifier will need I’ll have to figure out, too. Some testing would be good. It would be ideal to find someone with a boat who thinks this sort of thing is cool. I think I have several weekends worth of project to keep me busy.

<> 4627 529 >

Florida &Law and Politics Wesley R. Elsberry on 29 Apr 2013

Florida: State Employee Raises v. Total Compensation Reduction

An article in The Florida Current reports that the Florida legislature has come to an agreement to give career service state employees a raise — the first in almost seven years. Career service workers earning more than $40K a year would see a $1K increase, and those earning less than that would get a $1.4K increase.

It’s not much, for sure, but it is a step in the right direction.

A definite step in the wrong direction was the State Supreme Court blessing the money grab labeled as “pension reform” earlier this year. In 2011, career service employees, then five years from any general raise in salary, were mandated to contribute 3% of their salary to the pension plan. Gov. Rick Scott cited common practice in private industry and other states of requiring employee salary contributions to retirement plans in pushing for this change, but nowhere was it said that it was common practice anywhere to reduce employee total compensation unilaterally. Instead of increasing funding to the pension plan, the state simply reduced its total contribution to the pension plan, effectively reducing employee total compensation.

The two countervailing results can be tallied up together to yield an effective compensation change value now.

Salary Reduction in total compensation Raise Effective compensation change
10000 -300 1400 1100
15000 -450 1400 950
20000 -600 1400 800
25000 -750 1400 650
30000 -900 1400 500
35000 -1050 1400 350
40000 -1200 1000 -200
45000 -1350 1000 -350
50000 -1500 1000 -500
55000 -1650 1000 -650
60000 -1800 1000 -800
65000 -1950 1000 -950
70000 -2100 1000 -1100

If you are a career service state employee making less than $40K per year, the legislature’s proposed raise will provide more positive change in compensation than the “pension contribution” reduced it. If, though, you are making more than $40K per year, the amount of the the salary raise is less than the total compensation amount removed by the “pension contribution”; you are still effectively in the hole or underwater or whatever term might apply to this form of being shafted by your employer.

<> 17151 1297 >

Antievolution Wesley R. Elsberry on 10 Feb 2013

Another Uninformed Critique of WIDF Fails

In 2009, Lita Cosner of Creation Ministries International posted a review of the 2004 book “Why Intelligent Design Fails”, claiming in summary that there was nothing in the book to cause discomfort to an “informed creationist”, and that actual problems for “intelligent design” creationism were rare in the book. Here in 2013, let’s have a look at Cosner’s specific critique of the chapter that Jeff Shallit and I contributed.

“Playing Games with Probability”

Shallit and Elsberry, in their essay “Playing Games with Probability”, claim that intelligent design theorists misuse probability in the same way that Bible code pseudo-scientists do. They more specifically argue that Dembski’s use of probability is unjustified and inconsistent (p. 130), and gives “wildly differing results” depending on which method is used (p. 132).

They, along with many of the other authors, use genetic algorithms, and specifically Dawkins’ “weasel” algorithm, to prove that natural selection and mutation are sufficient for evolution to occur. But, as even the authors acknowledge, they do not accurately represent biological evolution, so it is dishonest to use the algorithms as proof for evolution.11–13

It is common for evolutionists to use situations (as Shallit and Elsberry do), such as flipping a coin 50 times to come to an improbable sequence, to demonstrate how improbable things can happen. But in that example, there must be some outcome. But it was not necessary that the universe be suitable for life, or that life would occur even in a universe suitable for it. Since there are many more ways for the universe to be unsuitable for life than suitable for it, and for something to be dead than to be alive, this warrants a sufficient explanation.14

Let’s toss in Cosner’s associated footnotes:

11. Batten, D., Genetic algorithms—do they show that evolution works? , 2008.

12. Truman, R., The weasel returns: Truman replies to Curtis, Journal of Creation 15(2):55– 58, 2001.

13. Abel, D.L., The Capabilities of Chaos and Complexity, International Journal of Molecular Sciences 10:247–291, 9 January 2009 doi:10.3390/ijms10010247 (emphasis added): All too many evolutionary computationists fail to realize the purely formal nature of GA [genetic alogrithims] procedures. GAs are not dealing with physicodynamic cause-and-effect chains. First, what is being optimized is a formal representation of meaning and function. A representation of any kind cannot be reduced to inanimate physicality. Second, “potential solutions” are formal, not merely physical entities. Third, at each iteration (generation) a certain portion of the population of potential solutions is deliberately selected by the agent experimenter (artificial selection) to “breed” a new generation. The optimized solution was purposefully pursued at each iteration. The overall process was entirely goaldirected (formal). Real evolution has no goal. Fourth, a formal fitness function is used to define and measure the fittest solutions thus far to a certain formal problem. The act of defining and measuring, along with just about everything else in the GA procedure, is altogether formal, not physical.

14. Sarfati, By Design, ch. 16.

The first paragraph shows that Cosner read material that makes the second paragraph completely unsupportable. We certainly did note that Dembski’s use of probability was inconsistent, but we stated that this was apparent in an example of something Dembski himself critiqued, and that something was the Dawkins’ “weasel” program. Cosner’s second paragraph claims things that Cosner might wish that we said, but did not. Specifically, we never stated any such thing as genetic algorithms being “proof of evolution”. In dealing with Dembski’s critiques, one has no need of such claims. It is entirely sufficient to note that Dembski is misinformed about, overlooks, or misrepresents the properties of evolutionary computation systems that he criticizes or dismisses out of hand, or even (as we did) demonstrate inconsistencies within the critiques he makes of a single system. Genetic algorithms and evolutionary computation more broadly are useful rejoinders to certain broad claims religious antievolutionists make, but they do not directly bear on the question of a history of evolution and biological common descent as Cosner erroneously asserts we claimed. (Abel’s gobbledygook from footnote 13 is portentous but irrelevant; Dembski remains inconsistent in assigning probabilities, whether one calls the system Dembski critiqued “formal”, “informal”, or “stunning in a mauve chiffon dress”.)

In the third paragraph, Cosner asserts, “It is common for evolutionists to use situations (as Shallit and Elsberry do), such as flipping a coin 50 times to come to an improbable sequence, to demonstrate how improbable things can happen.” This only makes sense if we were attempting to make some sort of apologia for small probabilities. Cosner rather thoroughly misses our point. That’s the charitable reading of Cosner’s critique. On page 122, we noted the central problem that for a given observation of a result such as that of a sequence of coin flips, the likelihood of any possible such sequence is exactly equal to any other such sequence, but we would like to distinguish between those that can be ascribed to chance and those which cannot be ascribed to chance. This is exactly the thing that Dembski claims to have halfway solved, but which we demonstrate he is not even close to doing. Our critique is aimed at showing that Dembski has not sufficiently justified his claims.

Let’s see Cosner’s dismissive conclusion:

To refute all the arguments in this book would require a book in and of itself. Indeed, most of the arguments are addressed in Jonathan Sarfati’s By Design, though it was not written to refute this book specifically. Where Why Intelligent Design Fails does point out a valid weakness in ID theory (which is rare), it is one of the weaknesses which results from ID’s refusal to name the Creator, or from the acceptance of theistic evolution by some ID theorists. These are weaknesses that biblical creation does not share with ID theory, so there is nothing in this book that should challenge an informed creationist.

Our conclusion is entirely overlooked by Cosner:

The bottom line is that Dembski’s specified complexity or complex specified information is an incoherent concept. It is unworkable, is not well-defined, and does not have the properties he claims for it. Even Dembski himself, in attempting to calculate the specified complexity of various events, uses an inconsistent methodology. Most important, specified complexity does not provide a way to distinguish designed objects from undesigned objects.

Biochemist Russell F. Doolittle (1983) once remarked, “The next time you hear creationists railing about the ‘impossibility’ of making a particular protein, whether hemoglobin or ribonuclease or cytochrome-c, you can smile wryly and know that they are nowhere near a consideration of the real issues” (261). That same wry smile might be useful to keep handy when reading Dembski’s claims.

The faults we note for Dembski’s ideas are not due to “failure to name the Creator”, and certainly have nothing to do with Dembski’s thoroughgoing rejection of theistic evolution (the actual case, to be distinguished from Cosner’s inexplicable assertion to the opposite effect). That also means the faults remain the same for those ideas whatever the belief status of the promulgator of them.

“Informed creationists” should know that Dembski’s ideas and more generally those of “intelligent design” creationism didn’t appear as a novelty. No less a personage than Henry Morris of the Institute for Creation Research pointed that out fairly bluntly in “The Design Revelation”:

Our other hesitation to get on this bandwagon is their use of the same arguments and evidences we Biblical creationists have used for years, while simultaneously trying to distance themselves from us. Our adherence to Biblical literalism is ridiculed by evolutionists, and the ID advocates would be embarrassed to be tarred with the same brush.

Morris specifically (!!) noted concordance between ideas Dembski writes about and ideas Morris wrote about long before Dembski appeared on the scene.

Dembski uses the term “specified complexity” as the main criterion for recognizing design. This has essentially the same meaning as “organized complexity,” which is more meaningful and which I have often used myself. He refers to the Borel number (1 in 1050) as what he calls a “universal probability bound,” below which chance is precluded. He himself calculates the total conceivable number of specified events throughout cosmic history to be 10150 with one chance out of that number as being the limit of chance. In a book4 written a quarter of a century ago, I had estimated this number to be 10110, and had also referred to the Borel number for comparison. His treatment did add the term “universal probability bound” to the rhetoric.

The notion that “informed creationists” could rest easy, that “Why Intelligent Design Fails” wasn’t about anything they have an interest in, is complete balderdash. “Intellgent design” creationism is just “creation science” with more Wite-Out, just as “creation science” is simply “scientific creationism”, and both of those are “biblical creationism” with Wite-Out. Dembski is just among the latest to mouth and embellish improbability arguments for religious antievolution. As Morris noted, Dembski modified the rhetoric, not the argument.

<> 56082 4077 >

Antievolution &Law and Politics Wesley R. Elsberry on 17 Jan 2013

Final Decision Goes Against Coppedge

The Coppedge v. CalTech and JPL case is done, with a final decision handed down by Judge Hiroshige on Wednesday that confirms his preliminary ruling in favor of JPL. There are news reports here and here about the end of the case. Coppedge had sued, claiming wrongful termination, saying that JPL fired him from his job as a systems administrator because of his religious views. JPL defended itself by bringing to light Coppedge’s personality quirks and also his refusal to get up to speed on the new systems technology that JPL was switching over to. Coppedge was one of about 200 people laid off in a downsizing operation there.

Coppedge’s attorney isn’t letting the press opportunity get away. From the Star News article:

“David was the victim of religious discrimination because a handful of malicious co-workers hated his Christian views, as well as his interest in intelligent design, which they ignorantly perceived to be a religious concept,” Coppedge’s attorney William Becker said in a statement Thursday. “He was demoted and fired for simply being a Christian and someone who believes that nature can be scientifically explained by reference to designs found within it.”

We know that IDC advocates have to deny IDC’s religious character, but that doesn’t make people ignorant for not buying into the deception.

From the La Canada Online article:

Becker — who declined to comment beyond his written statement — contended that by “rubber-stamping” JPL’s proposed judgment, and not issuing a thorough written ruling of his own, it would work in Coppedge’s favor going forward.

“By failing to address the evidence personally, thoughtfully and carefully, [Hiroshige] left the door wide open,” said Becker. “By overruling our objections without giving a reason, the judge has all but handed us a victory on appeal.”

There is a cottage industry of lawyers looking to make their reputation in defending the religious right, and there is some pretty fierce competition for recognition. Becker appears to be participating in that game. As I understand it (and I am not a lawyer), the appeals court will have to take the case with all the findings of fact as they stand; their only review power concerns procedure and findings in law. Contrary to Becker’s statement, it is not clear at all that an appeals court will simply have to overturn the decision. Becker heads into the appeal with the facts as determined by the trial court being that JPL established cause for dismissal of Coppedge and appropriately answered claims of religious discrimination. That puts him behind the eight ball. The appeals court would have to agree that at least one of Becker’s arguments was cogent and revealed an actual difficulty in law rising to reversible error. This, it seems to me, is far from the high probability that Becker assigns to it.

<> 65388 5030 >

Antievolution &Computation &Education &Family &Florida &Law and Politics &Science Wesley R. Elsberry on 01 Jan 2013

A New Year

The Mayan apocalypse failed to appear, so I had a nice New Year’s day here in Florida. The temperature got into the 70s here, and not too breezy, so Diane and I worked on various things that all too recently would have been too hot to do comfortably. But here in the evening, I’m reflecting a bit over what has gone by, and thinking about things to be accomplished in the coming year.

One of the major items in the works is finishing off a document for a plan of action in handling TalkOrigins Archive web sites. The success of the Panda’s Thumb has for some time made it the main point of interest, but there has been discussion about a major overhaul of the TalkOrigins web site itself. I’m putting this together via a Google Docs document. The document discusses a collection of web applications for future TalkOrigins Archive holdings. The Panda’s Thumb weblog serves as a front-lines resource with its usual interactivity. The current static HTML TalkOrigins Archive should be preserved so as not to break web resources with links to those materials. But those materials and more will be made available in a content management system. Developing new materials for the CMS will be part of the job for a Wiki. There is also the idea that a full-blown forum package could handle free-form discussions for those without good access to Usenet newsgroups. The critical component in all this, though, is setting up an effective volunteer organization. And that’s the part of the document that I am working on putting together now. When complete, we’ll be having a full call for volunteers. (If you would like to become a volunteer for the TalkOrigins Archive now, please leave a comment indicating your interest and skill set.)

I’m still looking to move ahead with various academic publications that have been in process for quite some time. One thing I was doing today was looking through files, which reminds me of just how much of a backlog there is. I did run across my script for my 2002 presentation at the World Skeptic’s Conference, which reminds me of another activity that I’ve deferred: putting my various presentations in video format and putting them online.

And the science education situation in Florida looks like it may get even more interesting in the future. Our new state education commissioner, Tony Bennett, was touted as a featured speaker for a “Creation Evidence Expo” in 2009, then cancelled when it made the news.

There’s the whole issue of data center consolidation for Florida’s state agencies, a process that is supposed to be complete within the next six years or so. The legislative mandate to do this came down some time ago, but it seems to me that the legislature was not properly informed of the downside of data center consolidation: you may save money on personnel, but a frighteningly large proportion of such projects fail outright. Failure of data systems for state agencies is a pretty bad potential downside to have. There are other issues with the implementation of the data centers. The state is aiming to put everything into two data centers, both of them physically located in the state capitol, Tallahassee. That makes it convenient for the state administration, certainly, but anyone who has looked at data bandwidth in high-speed Internet systems would notice that Tallahassee is not in the path of main trunk lines. Data flow, and low latency, is a critical part of client/server and n-tier architectures, and putting the central data repositories at the end of a thin pipe seems an odd choice. Part of the benefit of having multiple data centers is backup and failover capability; these, though, are rather less effective the closer the places are physically. Power outages are more likely to take down both centers when they are in the same geographic locale, and disasters are more likely to effect both, too. Having a data center in Tallahassee makes sense, but having the premier data center elsewhere (somewhere with much better bandwidth access, for one) would make much more sense. There’s lots more to talk about on this topic, and I hope to do some of that later.

<> 76149 5724 >

Law and Politics Wesley R. Elsberry on 20 Nov 2012

Florida: Allen West Concedes

CBS News reports that Allen West(R) has finally conceded the House race for Florida’s 18th District to challenger Patrick Murphy(D).

Patrick Murphy wasn’t waiting on that, though; the report says that he is already in Washington, D.C. for orientation.

<> 92760 5649 >

Antievolution &Law and Politics &Science Wesley R. Elsberry on 19 Nov 2012

Florida: Marco Rubio is Not A Scientist, Man

US Senator from Florida Marco Rubio gave an interview to GQ recently. Rubio was asked a question that Republican politicians simply hate to field: How old is the earth? (Hat tip: Talking Points Memo.)

Why is this a difficult question? It isn’t because the science hasn’t been disseminated; this is a part of any middle or high school earth science course. It isn’t because of any ambiguity in the science; an age of about 4.5 billion years has been current for years, with relatively small adjustments for precision. The reason it is a difficult question is that answering it without quibble will annoy the 40 to 45% of the US population who have consistently answered the Gallup poll question on this subject by saying that the earth is about 10,000 years old. That demographic also happens to provide Republican politicians with their consistent voting bloc, so annoying them is the absolutely last thing such a politician wants to do.

So let’s have a look at how Marco Rubio did respond when the question came up in the GQ interview:

GQ: How old do you think the Earth is?

Marco Rubio: I’m not a scientist, man. I can tell you what recorded history says, I can tell you what the Bible says, but I think that’s a dispute amongst theologians and I think it has nothing to do with the gross domestic product or economic growth of the United States. I think the age of the universe has zero to do with how our economy is going to grow. I’m not a scientist. I don’t think I’m qualified to answer a question like that. At the end of the day, I think there are multiple theories out there on how the universe was created and I think this is a country where people should have the opportunity to teach them all. I think parents should be able to teach their kids what their faith says, what science says. Whether the Earth was created in 7 days, or 7 actual eras, I’m not sure we’ll ever be able to answer that. It’s one of the great mysteries.

This is a troubling thing for a powerful politician to say. Its sole purpose can only be to give comfort to the biblical literalist voting bloc. Why is it troubling? Let’s go through the response piece by piece.

I’m not a scientist, man.

This is baloney, pure and simple. You don’t have to be a scientist to answer this question on Jeopardy, or in a GQ interview. It just requires that you actually know what the answer is.

I can tell you what recorded history says, I can tell you what the Bible says, but I think that’s a dispute amongst theologians and I think it has nothing to do with the gross domestic product or economic growth of the United States.

We do not know that Rubio can tell us what history, the Bible, or science says, because he never actually gave any of the different numbers that are used to answer the question. We’re just supposed to accept that Rubio could give those numbers, if he were so inclined. If he can’t do so in the low-pressure context of a GQ interview, though, I doubt that we will hear them from him elsewhere.

The “dispute among theologians” clause is also baloney. Yes, theologians do dispute the age of the earth, but they aren’t the only people who have weighed in on this topic. Rubio’s disclaimer that he isn’t a scientist does indicate that he is aware that science has an answer, but Rubio is here also implicitly disclaiming that science’s answer has any priority in the discussion.

Then there is Rubio’s assertion that the question is without consequences for our economy. This is, of course, hogwash. The manufactroversy over the age of the earth does have consequences. One of the most important consequences is the widespread distrust of scientists and the findings of science that are propagated when religious interpretations are promoted as putting scientific findings into question. Children who are taught that science is in a conspiracy are less likely to accept other things that science discovers and are less likely to themselves take up careers in science and technology. Our gross domestic product, our economic growth, and even our ability to field ever more sophisticated military technology is critically dependent on maintaining an edge in science and technology. How can disputing even the simplest and most basic scientific findings, like that of the age of the earth, possibly do anything but make it less likely that the USA will succeed in its race to keep pace or keep ahead of science progress in the rest of the world?

I think the age of the universe has zero to do with how our economy is going to grow.

The age of the universe has some pretty direct consequences for how scientists view critical cosmological constants. Those constants feed into equations of behavior of matter and energy in the here and now, so, yes, the age of the universe has a part in the operation of science and technology in the here and now, and, yes, it makes a difference for our economy, as explained just above.

I’m not a scientist. I don’t think I’m qualified to answer a question like that.

As noted before, you don’t have to be a scientist to know the answer. It seems that Rubio should not be a contestant on Jeff Foxworthy’s “Are You Smarter Than a Fifth-Grader?”

At the end of the day, I think there are multiple theories out there on how the universe was created and I think this is a country where people should have the opportunity to teach them all.

Senator Rubio should know that people can talk about whatever conjectures they want to. That’s what free speech is for. But Senator Rubio should also know that we teach curricula by subjects for a reason. Accountable science is the only thing that should be taught in science classes. For theological concepts in the public schools, there would need to be a course on philosophy or comparative religion. It has been a consistent feature of evolution versus creation dustups that biblical literalists have no interest in having their concepts compared and contrasted with those from other religions in an even-handed way in comparative religion courses; they want their unevidenced, unaccountable, untestable conjectures taught as if they were science, and as if they had the same scientific stature as accountable science.

I think parents should be able to teach their kids what their faith says, what science says.

They are able to do so, Senator Rubio. Parents can and do teach theological concepts at their churches, their religious private schools, and in homeschooling. They should, but often do not, teach the relevant science in religious private schools and homeschooling.

Whether the Earth was created in 7 days, or 7 actual eras, I’m not sure we’ll ever be able to answer that. It’s one of the great mysteries.

Ignorant people can’t answer it. People committed to obfuscation won’t answer it. But that doesn’t mean that there is not an answer. It is not a mystery. It is a matter of record in a well-developed, accessible scientific literature, with popular treatments readily available, and treatments in textbooks as well.

Rubio is replaying “Roman Catholic Church v. Galileo”. He should refer to that to see how obscurantists have fared. The RCC eventually came to the realization that the anti-scientific interpretation they had committed themselves to was not a necessity to faith. That realization is still in the future for many concerning the age of the earth, but they will eventually have to come to the same conclusion.

<> 90931 6317 >

Law and Politics &Media Wesley R. Elsberry on 23 Oct 2012

False Balance in Fact Check

The Chicago Tribune Fact Check on the debates goes for that false balance thing in the headline:

“FACT CHECK: Romney flubs geography, Obama goofs on rival’s record, in final debate”

Mitt Romney, candidate for Commander-in-Chief, who not long ago identified Iran as a tippy-top threat to the security of the USA, has no clue about Iran’s geography or military disposition, which includes lots of threats to close the Strait of Hormuz to shipping. President Obama, on the other hand, is unlikely to launch a war on Massachusetts over the historical footnote that is Mitt Romney’s single-term governorship. Would it have been better if Obama knew more about the details of Mitt’s gubernatorial history? Sure. Is it anywhere comparable to Mitt’s thorough-going ignorance of current world affairs? I don’t think so.

<> 85708 5610 >

Computation &Science &Wildlife Wesley R. Elsberry on 08 Oct 2012

Population Modeling in Python

One of the courses I enjoyed most in my Ph.D. program was taught by Prof. Kirk Winemiller on population dynamics. There are various collections of models in various languages out there, and multi-model population dynamic applications. But I still think that there is some utility to rolling my own. Since 2009, I’ve gotten more into Python programming, so I thought that I would take a popular class of population dynamic models and produce a Python module to instantiate them.

A long-time standard method in population modeling is the Leslie matrix. This technique applies when one has data about the age structure of a population and produces estimates going forward by using matrix multiplication to go from the population numbers, fecundity, and survivorship numbers to get the estimate of the population in each age class at the next time step.

A similar method is the Lefkovitch approach. This is still based upon matrix operations, but the underlying data involves stages rather than age structure. This sort of model is often used to capture more complex life histories than are tracked in a Leslie matrix model.

The similarities make it straightforward to incorporate both approaches into one supporting Python class.

The following Python module defines the LMatrix class. The dependencies are the Numpy module and the interval module. I used “pip install interval” to get the interval module on my machine. If you run this module in standalone mode, it runs a test of the LMatrix model with a web-accessible example of a Leslie matrix and of a Lefkovitch matrix.

  1. """
  2. popdyn.py
  3.  
  4. Trying out population dynamics in Python.
  5. Wesley R. Elsberry
  6.  
  7. """
  8.  
  9. class LMatrix:
  10.     """
  11.    LMatrix
  12.  
  13.    A support class for Leslie and Lefkovitch matrix use for
  14.    population dynamics.
  15.  
  16.    This is a generic class that allows for an arbitrary number of age
  17.    classes or stages.
  18.    """
  19.  
  20.     def __init__(self,stAges):
  21.         import numpy as num
  22.         import numpy.matlib as M
  23.         from numpy.matlib import rand,zeros,ones,empty,eye
  24.         import interval
  25.  
  26.         """
  27.        In either Leslie age-structured or Lefkovitch stage-
  28.        structured population modeling, the central feature
  29.        is a special matrix representing both fecundity of
  30.        ages/stages and survivorship in each age/stage.
  31.  
  32.        The Leslie age-structured matrix is slightly simpler,
  33.        since each iteration moves the population forward
  34.        by a time step equal to the difference between the
  35.        age classes.
  36.  
  37.        The Lefkovitch stage-structured matrix,
  38.        on the other hand, may have unequal times spent in
  39.        each stage, and thus other elements of the matrix
  40.        represent the fraction of individuals that continue
  41.        to remain in the stage per time step of the model.
  42.        Those lie on the main diagonal.
  43.  
  44.        The matrix in either case is an N-by-N matrix, where
  45.        N is the number of ages or stages (stAges parameter).
  46.        Because most values in the matrix are zero, we'll
  47.        start with that.
  48.        """
  49.  
  50.         self.stAges = stAges  # Keep track of how many age/stage classes there are
  51.         self.m = zeros((self.stAges,self.stAges))
  52.         self.step = 0  # We are at the beginning
  53.         self.popvec = None
  54.         self.survival = None
  55.         self.recurrence = None
  56.         self.fecundity = None
  57.  
  58.     def LM_AddFecundity(self,fvector):
  59.         """
  60.        Method to set fecundity values for an LMatrix.
  61.  
  62.        This is done by setting the first row of the
  63.        matrix to the values in the vector.
  64.  
  65.        A mismatch between the length of the vector and
  66.        the width of the matrix leaves both unchanged.
  67.        """
  68.         if (fvector.shape[0] == self.stAges):
  69.             # Just replace the row
  70.             self.m[0] = fvector
  71.             # Save it in the object
  72.             self.fecundity = fvector
  73.         else:
  74.             print "Mismatch in size: %s vs. %s" % (self.stAges - 1,fvector.shape[0])
  75.  
  76.     def LM_AddSurvival(self,survival):
  77.         """
  78.        Add the values for survival that shift population members
  79.        from one age/stage to the next.
  80.        The values come in as the "survival" vector, a Numpy array.
  81.        They replace values in the m matrix in the diagonal from
  82.        [1,0] to [N-1,N-2].
  83.        """
  84.         if (survival.shape[0] == (self.stAges - 1)):
  85.             for ii in range(1,self.stAges):
  86.                 self.m[ii,ii-1] = survival[ii-1]
  87.             # Save it in the object
  88.             self.survival = survival
  89.         else:
  90.             print "Mismatch in size: %s vs. %s" % (self.stAges - 1,survival.shape[0])
  91.  
  92.     def LM_AddRecurrence(self,recur):
  93.         """
  94.        Add the values for survival of organisms remaining in the same
  95.        stage. This is for stage-structured population models only.
  96.        The input is as the vector recur, and its values replace those
  97.        in the m matrix along the main diagonal from [1,1] to [N-1,N-1].
  98.        """
  99.         if (recur.shape[0] == (self.stAges - 1)):
  100.             for ii in range(1,self.stAges):
  101.                 self.m[ii,ii] = recur[ii-1]
  102.             # Save it in the object
  103.             self.recurrence = recur
  104.         else:
  105.             print "Mismatch in size: %s vs. %s" % (self.stAges - 1,recur.shape[0])
  106.  
  107.     def LM_SetOneRelation(self,fromState,toState, value):
  108.         """
  109.        Method to set a relation that does not fall on the survival
  110.        diagonal or the recurrence diagonal. This is useful for more
  111.        complex stage-structured population modeling where organisms
  112.        from one stage may graduate to multiple other stages at defined
  113.        rates.
  114.        """
  115.         iv = interval.Interval.between(0,self.stAges-1)
  116.         if ((fromState in iv) and (toState in iv)):
  117.             print self.m
  118.             self.m[toState,fromState] = value
  119.             print self.m
  120.    
  121.     def LM_SetPopulation(self,popvector):
  122.         """
  123.        Another central feature of these models is that the size
  124.        of the population is kept in a 1xN column vector. For the
  125.        implementation here, the actual representation is as a
  126.        Numpy array, which has no column vector as such. This will
  127.        be handled in the actual stepping method.
  128.        """
  129.         if (popvector.shape[0] == (self.stAges)):
  130.             self.popvec = popvector
  131.         else:
  132.             print "Mismatch in size: %s vs. %s" % (self.stAges,popvector.shape[0])
  133.  
  134.     def LM_StepForward(self):
  135.         """
  136.        Do the matrix multiplication to obtain the new population
  137.        vector. Retain the previous population vector.
  138.  
  139.        Handle turning population vector into a column vector for the
  140.        multiplication.
  141.        """
  142.         # Convert the population array to a Numpy matrix and transpose it
  143.         # to get the column vector we need. Multiply the L* matrix by
  144.         # the column vector, resulting in a new column vector with the
  145.         # population at the next step.
  146.         nextpopvec = num.mat(self.m) * num.mat(self.popvec).T
  147.  
  148.         # Save the old population vector
  149.         self.lastpopvec = self.popvec
  150.  
  151.         # Replace the population vector with the new one, which means
  152.         # transposing it and converting to Numpy array type
  153.         self.popvec = num.array(nextpopvec.T)
  154.  
  155.         # Track the number of steps taken
  156.         self.step += 1
  157.  
  158.     def LM_TotalPopulation(self):
  159.         """
  160.        Return the total population size. Sums the "popvec" vector.
  161.        """
  162.         if (None != self.popvec):
  163.  
  164.             # Population vector as array multiplied by column vector of 1s is a sum
  165.             t = num.mat(self.popvec) * ones(self.stAges).T
  166.  
  167.             return t[0,0]
  168.         else:
  169.             return 0.0
  170.  
  171.  
  172. if __name__ == "__main__":
  173.     """
  174.     Generic initialization suggested at
  175.     http://www.scipy.org/NumPy_for_Matlab_Users
  176.    """
  177.     # Make all numpy available via shorter 'num' prefix
  178.     import numpy as num
  179.     # Make all matlib functions accessible at the top level via M.func()
  180.     import numpy.matlib as M
  181.     # Make some matlib functions accessible directly at the top level via, e.g. rand(3,3)
  182.     from numpy.matlib import rand,zeros,ones,empty,eye
  183.     # Define a Hermitian function
  184.     def hermitian(A, **kwargs):
  185.         return num.transpose(A,**kwargs).conj()
  186.  
  187.     # Make some shorcuts for transpose,hermitian:
  188.     #    num.transpose(A) --> T(A)
  189.     #    hermitian(A) --> H(A)
  190.     T = num.transpose
  191.     H = hermitian
  192.  
  193.     import interval
  194.  
  195.        
  196.     # Check it against an existing example data set
  197.     # http://www.cnr.uidaho.edu/wlf448/Leslie1.htm
  198.  
  199.     ex1 = LMatrix(4)
  200.  
  201.     fex1 = num.array([0.5, 2.4, 1.0, 0.0])
  202.     ex1.LM_AddFecundity(fex1)
  203.  
  204.     sex1 = num.array([0.5, 0.8, 0.5])
  205.     ex1.LM_AddSurvival(sex1)
  206.  
  207.     pex1 = num.array([20, 10, 40, 30])
  208.     ex1.LM_SetPopulation(pex1)
  209.  
  210.     print pex1
  211.     print ex1.m
  212.     ex1.LM_StepForward()
  213.     print ex1.popvec
  214.    
  215.     # It checks out!
  216.  
  217.     # Another example, this time of a stage-structured population
  218.     # http://www.afrc.uamont.edu/whited/Population%20projection%20models.pdf
  219.     ex2 = LMatrix(3)
  220.  
  221.     fex2 = num.array([0.0, 52, 279.5])
  222.     ex2.LM_AddFecundity(fex2)
  223.  
  224.     sex2 = num.array([0.024, 0.08])
  225.     ex2.LM_AddSurvival(sex2)
  226.  
  227.     rex2 = num.array([0.25, 0.43])
  228.     ex2.LM_AddRecurrence(rex2)
  229.  
  230.     pex2 = num.array([70.0,20.0,10.0])
  231.     ex2.LM_SetPopulation(pex2)
  232.  
  233.     print pex2
  234.     print ex2.m
  235.     ex2.LM_StepForward()
  236.     print ex2.popvec
  237.     print ex2.LM_TotalPopulation()
  238.  
  239.     ex2.LM_StepForward()
  240.     print ex2.LM_TotalPopulation()
  241.  
  242.     ex2.LM_StepForward()
  243.     print ex2.LM_TotalPopulation()
  244.  
  245.     for ii in range(22):
  246.         ex2.LM_StepForward()
  247.     print ex2.popvec
  248.    
  249.     # Tests OK!

Output from the standalone run:

  1. [20 10 40 30]
  2. [[ 0.5  2.4  1.   0. ]
  3.  [ 0.5  0.   0.   0. ]
  4.  [ 0.   0.8  0.   0. ]
  5.  [ 0.   0.   0.5  0. ]]
  6. [[ 74.  10.   8.  20.]]
  7. [ 70.  20.  10.]
  8. [[  0.00000000e+00   5.20000000e+01   2.79500000e+02]
  9.  [  2.40000000e-02   2.50000000e-01   0.00000000e+00]
  10.  [  0.00000000e+00   8.00000000e-02   4.30000000e-01]]
  11. [[ 3835.       6.68     5.9 ]]
  12. 3847.58
  13. 2093.1914
  14. 5811.535142
  15. [[ 19837904.89838918    393232.36554185     30519.85368983]]
<> 88007 6145 >

General Wesley R. Elsberry on 07 Oct 2012

Anatomy of a Spam Comment

The new spam module for WordPress is not as aggressive in marking spam messages as its previous version. So I get to go through and mark a variety of things that are pretty obviously spam as spam.

Well, today a spammer’s script misfired and sent his template for a comment rather than a processed spam comment itself. For the morbidly curious, I’ll quote it here:

{Pretty|Attractive} section of content. I just stumbled upon your {blog|weblog|website|web site|site} and in accession capital to assert that I {acquire|get} {in fact|actually} enjoyed account your blog posts. {Any way|Anyway} {I?ll|I will} be subscribing to your {augment|feeds} and even I achievement you access consistently {rapidly|fast|quickly}.

The obvious way this kind of thing works is that the script gets a list of websites to crawl and look for comment blocks. Then, it should use the template to generate a plaintext message using only on alternative from each of the selections in curly braces. This helps keep the spam detection software off guard, since with even a few alternatives at each of several positions, the permutations can reach an astounding number. In this case, whatever script was supposed to actually select alternatives and emit plaintext obviously failed. Given how broken the grammar is, perhaps one should expect the coding to be of similar quality.

<> 84952 5524 >

General Wesley R. Elsberry on 23 Sep 2012

Delta

In the past week, I’ve quit working for the Fish and Wildlife Research Institute, updated my will, had two recalled tires replaced on my truck, and otherwise worked toward clearing the decks for the job I start tomorrow.

I’ll be working as an analyst for RealPage, Inc., particularly with the group based in Carrollton, Texas who works on the MPF Market Intelligence software product. The plan is that I will travel to Texas as necessary, but mostly work from my home in Florida. I’ve known my new supervisor, Richard Hughes, for several years via online communication, and I’m looking forward to the new job.

This will also provide me opportunities to visit with my friends in Texas, most often those in the DFW area (Marc, Elke, Zach, Dan, Lorraine, Rene’, Ernie, and many more), then those a bit further out (Toni, Melinda, Miranda, Bill), and my current colleague (Laura) and lots of former colleagues at UTA and TAMU. Social networking beats lack of communication, but there’s nothing quite like meeting up in person.

And I’ll still have my native state, Florida, to enjoy and work on improving. This is going to be a cool thing.

<> 82578 5378 >

Law and Politics Wesley R. Elsberry on 06 Sep 2012

Cooperation and Distinguishing the General from the Specific

The New York Daily News ran an article from the Associated Press on fact-checking former president Bill Clinton’s speech last night at the Democratic National Convention. Usually, I would simply quote relevant sections, but given the Associated Press’ litigious approach to being quoted on blogs, I will have to recommend that you open the link above in a new tab or window and look for yourself.

The AP article claims that Clinton was guilty of mischaracterizing and cherry-picking, saying that they would provide several examples. The first example? An examination of Clinton discussing cooperation, where they identify the following section of Clinton’s speech as a problem.

When times are tough, constant conflict may be good politics but in the real world, cooperation works better. After all, nobody’s right all the time, and a broken clock is right twice a day. All of us are destined to live our lives between those two extremes. Unfortunately, the faction that now dominates the Republican Party doesn’t see it that way. They think government is the enemy and compromise is weakness. One of the main reasons America should re-elect President Obama is that he is still committed to cooperation.

The AP then proceeds to establish a case that “both parties” are responsible for inflexibility and lack of cooperation in government today, something that they are able to establish in short order. Along the way, they note the “grand bargain” budget deal reached between President Barack Obama and Speaker John Boehner. That deal laid out spending cuts and tax increases that attracted the opposition of both parties, thus the proposal failed. The AP notes Obama being the impetus for the creation of a bipartisan congressional commission whose recommendations were not endorsed due to intransigence of the two parties. At the risk of getting sued, I feel I need to quote the AP’s conclusion of this exercise in “fact-checking”. Let’s hope “fair use” is still in vogue in the courts.

The problem with compromising in Washington is that there are few true moderates left in either party. The notion that Republicans are the only ones standing in the way of compromise is inaccurate.

Blink.

Yes, Clinton did mention the Republican Party in this context. One might fault Clinton, as the AP does, for not also mentioning a certain level of intransigence in his own party as an omission. Clinton’s subsidiary claim about the Republican Party, taken on its own, is not assailable, and the AP carefully avoided even broaching that topic. But the AP does not address the actual point that Clinton was making. The AP actually demonstrated in two examples of interaction with the legislature that Clinton’s point, specifically that one person, President Obama, has demonstrated commitment to cooperation, is true. The fact that efforts toward cooperation can fail despite one person’s willingness to engage and compromise is not acknowledged by the AP. Instead, they assign fault to Obama because factions in both parties could not agree to the compromises on the table. Clinton contrasts the intransigence of a faction of one party (something the AP wisely does not dispute, and even stipulates in its conclusion) with one person’s willingness to compromise (which the AP documents), yet the AP concludes Clinton erred here.

This is fact-checking? I don’t think so.

Take the 2012 Presidential Race Poll: How Do You Really Feel?

<> 75025 5274 >

Law and Politics Wesley R. Elsberry on 28 Aug 2012

How Do You Really Feel?

At the urging of Mike Haubrich, I coded up a poll as I was convalescing from my recent illness. The poll aimed to tease out some of the common motivations that go into the USA presidential vote. The current results are in graphical form:

If you’d like to put in your entry in the poll or change your entry, visit 2012 Presidential Race Poll: How Do You Really Feel?.

QR Code for the Poll:

QRCode

<> 47961 5122 >

Law and Politics Wesley R. Elsberry on 20 Aug 2012

David Frum Follows Akin into Idiocy

The breaking news story yesterday was Missouri Republican candidate for US Senate Todd Akin’s discussion of abortion and rape. On “The Jaco Report”, Akin was questioned about his anti-abortion stance and whether there should be an exception made to allow women who had been raped and became pregnant to get an abortion. Akin’s response turned out to be political suicide.

“It seems to me, from what I understand from doctors, that’s really rare,” Mr. Akin said of pregnancies from rape. “If it’s a legitimate rape, the female body has ways to try to shut that whole thing down. But let’s assume that maybe that didn’t work or something: I think there should be some punishment, but the punishment ought to be of the rapist, and not attacking the child.”

Akin’s already gotten quite the backlash over this. The Romney campaign made public its disagreement with Akin’s words. The national Republican party pulled his funding and made clear that his continued candidacy was a liability for other Republicans. And it appears that Akin will be withdrawing his candidacy shortly.

But let’s take a moment to try to establish just what it was that Akin got wrong here, because Akin has a big-name defender and the logic of stance-taking on this topic has been made an issue.

First, pregnancy resulting from rape is not “rare”. It is calculated to occur in about 5% of rape events.

“The national rape-related pregnancy rate is calculated to be 5 percent per rape among females aged 12 to 45 years,” according to the website of the American College of Obstetricians and Gynecologists. “This would be equivalent to approximately 32,000 pregnancies as a result of rape each year.” The medical organization issued a recommendation last August for all its ob-gyn members to “routinely screen all patients for a history of sexual assault,” especially those who complain about pelvic pain, menstrual irregularities and painful sex.

The expected number of pregnancies from rape is just slightly less than the number of fatalities resulting from automobile accidents in 2010.

The notion that a small enough demographic is a justification for removing a right is reprehensible. And we are not talking about a small demographic. We are talking about a demographic just about the same size as a leading cause of mortality in this country.

Second, it has been pointed out quite often that Akin is simply and completely wrong about a biological mechanism that makes rape different from other forms of sexual activity in terms of its potential to start a pregnancy. There simply is no legitimate basis for Akin’s claim that there is.

Third, there’s the whole “legitimate rape” phrasing. Assuming that Akin did not mean to say that some rape is justified, we are left with the surmise that Akin thinks that there is a subset of acts that other people call rape that meet some stricter standard that Akin would approve of. And there is history there to tell us that this is exactly what Akin was trying to say. Akin co-sponsored a bill last year with then-Representative and now vice presidential candidate Paul Ryan to redefine rape, coming up with the term “forcible rape” as the subset of rape that would justify exceptions to a ban on federal funding of abortions.

Federal law prevents federal Medicaid funds and similar programs from paying for abortions. Yet the law also contains an exception for women who are raped. The bill Akin and Ryan cosponsored would have narrowed this exception, providing that only pregnancies arising from “forcible rape” may be terminated. Because the primary target of Akin and Ryan’s effort are Medicaid recipients — patients who are unlikely to be able to afford an abortion absent Medicaid funding — the likely impact of this bill would have been forcing many rape survivors to carry their rapist’s baby to term.

One way to make a small demographic even smaller is to define it away. This is exactly what Akin and Paul Ryan were trying to do.

Fourth, Akin discusses punishment being doled out when rape results in pregnancy. Akin says punishment should go to the rapist, and not the “child”. It is telling that Akin leaves out a party here: the woman. Akin fails to acknowledge that his answer does impose punishment, the punishment of forced pregnancy and labor, with its associated risks of permanent debilitation, injury, and death, on every single woman who in that situation is denied access to an abortion that she wants. That’s up to 32,000 women a year meted out punishment, without appeal or even recognition of any due process right on which to make an appeal. Akin doesn’t even try to sugarcoat this process with offering compensation like that provided to surrogate mothers. This is an unfunded mandate, the costs of which are entirely borne by the victim of rape who becomes pregnant.

Remember how I talked about the demographic figure before, the 32,000 pregnancies expected per year from rape events? Couple that with the reported mortality rate in childbirth in 2008 of 24 in 100,000, and we have an expectation that Akin’s stance of denying access to abortion for pregnant rape victims would amount to a death sentence for about 8 women each year whose only crime was being a rape victim. 114 convicts were sentenced to death in 2010, so if we add in Akin’s new death sentence, we get 8 / (114 + 8) * 100 = 6.6% of new death sentences in the country each year under Akin’s plan for the crime of getting pregnant via rape. Rape victims… really, really dangerous people, apparently. And it should be noted that the sentence would be carried out in a matter of mere months, again with no appeal, and, in fact, no recognition of a due process right to take action upon at all.

I’m going to derive a rough estimate of relative rates of death sentences between homicide and Akin’s abortion restriction plan. Given the USA number of homicides in 2010 (14,474) and death sentences (114), there a missing element: what proportion of death sentences were handed out for homicide. I’m going to simply plug in some numbers to indicate a range of results to bracket things. The expected proportion of death sentences for pregnancy from rape is simple: 8/32000 * 100 = 0.025%. More crimes than homicide can contribute to death sentences, so the proportion there can be as high as 114/14474 * 100 = 0.79%. I wouldn’t expect more than half of the death sentences to come from non-homicide charges, so at the other end of the range we get 57/14474 * 100 = 0.39%. How much more common is a death sentence for “homicide” than “pregnancy via rape”? That will lie in the interval between 0.79 / 0.025 and 0.39 / 0.025, or [31.6 >= x >= 15.7]. If you commit homicide, you are only 16 to 32 times more likely to receive a death sentence than you are as a woman who becomes pregnant via rape. There’s some crime and punishment for you.

I think that lays out the problems in Akin’s reported stance. The first and second points reflect deep ignorance of the topic on Akin’s part. The third and fourth speak to a narrow ideological stance on the topic.

And now we come to Akin’s defender, David Frum. Frum worked for the George W. Bush administration, and has since produced a series of columns that vary wildly in merit. The current one is not one of his better offerings. Frum wrote a column titled, “Akin’s Abortion View: More Widespread in GOP Than You Think”. Now, I have no particular problem believing that a substantial proportion of the membership of the GOP could be deeply ignorant of basic biology and driven by a radical ideology concerning abortion, so I don’t see a problem with Frum’s choice of title. It is the structure of his argument that is a problem.

The word “moron” is being flung very freely at Todd Akin today, and it’s not fair.

Akin, the Republican candidate for U.S. Senate in Missouri, just blew a big hole in his campaign by telling a TV interviewer that in cases of “legitimate rape,” pregnancy hardly ever happens.

Akin was attempting to justify his view that abortion should be banned in nearly all cases. And yes, the use of the phrase “legitimate rape” suggests a certain lack of verbal nimbleness. Yet stupidity is not really the problem here.

Akin’s view of abortion—no exception for rape, incest, and life of the mother—is not his belief alone. It is also the view of Rick Santorum, the second-place finisher in the 2012 Republican nomination contest. On the eve of the Iowa caucuses, it became the position of Texas Gov. Rick Perry. It is the stance of Ken Connor, former president of the Family Research Council. Plainly, it is the position of a significant faction within the pro-life movement.

Well, “moron” might not be fair in some sense, but “ignoramus” would be perfectly justifiable, as I pointed out above. Stupidity might not be the problem, but essential ignorance really is. Frum’s basic fallacy here is a strawman: nobody I’ve seen was criticizing Akin just on the basis of the radical and rigid ideology he has adopted on abortion. It is Akin’s failed attempt to justify that radical and rigid ideology as having a basis in demographics on the one hand and biology on the other that leads to the conclusion, depending on the source, that Akin is a moron, stupid, or an ignoramus. Frum sets up and knocks down a weak argument that happens not to be one that anybody else was making, and acts as though he has accomplished something by doing so.

But Frum isn’t done yet. Does he get better? Let’s have a look.

And why not? If you believe that a pregnancy becomes a full human person at the very instant of conception, how can any of these exceptions make sense? Follow the hard logic of a strict pro-life position, and Akin’s view is where you end up. If I discover that my next-door neighbor was born of incest, I cannot wander over and shoot him dead. We don’t apply capital punishment even to the rapist; why should his innocent child pay for his crimes with its life? As for life of the mother, Akin explained his view on that issue well: he urged doctors to “optimize” life, ie, sometimes to choose the mother, but sometimes to choose the child when the child’s life seems more optimal.

These views may be shocking, but they are not stupid. With implacable logic, they derive from first principles. If anything, the logic of these views is tighter than the logic that leads the pro-life majority to favor the rape, incest, and life of the mother exceptions.

This is just putting a fancier suit on the strawman. [As pointed out by "ToSeek" in comments, I was hasty reading this part, and misread Frum as comparing anti-abortion and pro-choice stances. So this following bit I'm leaving in for completeness, but the stuff about pro-choice stance is not relevant to Frum's text: But even here, Frum is wrong. The assertion that pro-choice advocates can't lay claim to a stance based on logical conclusions from first principles is incorrect. Pro-choice advocates do have a principled stance, that women should be free to determine their own reproductive choices, including abortion. They just don't happen to live in a society where that can be implemented cleanly. Pro-choice advocates don't favor "exceptions" to bans on availability of abortion because they think that those "exceptions" are themselves the class of justified cases where abortion should be available; they favor those exceptions to bans on availability of abortion because even hard-core abortion advocates have a tough time coming up with good reasons beyond ideology why abortion should not be available in those cases.] Yes, radical ideology can have a certain purity of logic, but this is not a good argument for its validity. Nor is argumentum ad populum, another offering of Frum’s. The issues have to be worked out in the reality of a pluralistic society. [Added: Again, the point at issue is not how widespread Akin's views are or whether they have some pristine internal logical consistency, but rather how completely unsupported they are by the very classes of empirical evidence Akin tries to assert as support.]

Continue Reading »

<> 36606 5066 >

Raspberry Pi Wesley R. Elsberry on 10 Aug 2012

Pairing Raspberry Pi with Teensy++

I am looking forward to getting a Teensy++ 2.0 microcontroller board. Teensy is a low-cost, small microcontroller based on Atmel AVR technology that uses USB for the programming interface. USB can also be used by the device running the user’s programs in a variety of modes.

Teensy is something that I expect to solve a number of problems in deploying Raspberry Pi in embedded systems and instruments. The Raspberry Pi hardware exposes a number of GPIO pins, but that number is not large, and gets smaller as one uses special-purpose features like SPI and I2C, which are mapped to specific pins in the GPIO range. Raspberry Pi also has no built-in analog-to-digital capability. To protect the GPIO circuitry on the Raspberry Pi, one also has to do level-shifting to 3.3V. Attaching Teensy to a Raspberry Pi via USB does not risk the circuitry since nothing is going through the RasPi’s GPIO pins. I am intrigued by the USB HID mode, which looks like it may be amenable to a particularly flexible way of supporting two-way communication of commands and data between the two systems. Teensy also has several channels of analog-to-digital conversion built-in, as well as digital IO and PWM. With everything on and running at a full 16MHz, Teensy++ should draw less than 70 mA of 5V DC power. There is the potential for hooking up multiple Teensy systems to one RasPi via USB when using hubs.

I’ve also got multiple RasPis here, so I am in position to deploy a system and still be able to work on further development. The problem, as usual, is where to get the time.

<> 31076 5470 >

Law and Politics Wesley R. Elsberry on 09 Aug 2012

Welfare and Lying with Statistics

On Facebook, I ran across a graphic posted by “Things Liberals Hate” and shared by a Facebook friend. (The “share” apparently no longer exists in my friend’s thread, a few minutes after posting a link to my criticism to the thread. However, The Weekly Standard shows the original graphic.) It shows a bar graph of increasing numbers of Americans accepting some form of “federal welfare”. Beyond the terms of art in the original graphic, it has an immediate impact of implying that maybe 4x the number of people on welfare in 2009 Q1 were on welfare come 2011 Q2. That is, until one pays closer attention to the range of values on the Y axis. The range is from 94 million to 108 million. This gambit is a classic and is prominently featured in the also-classic book, Darrell Huff’s “How to Lie with Statistics”. Here’s a version of the original graphic I made using the same Y-axis range.

In order to illustrate how the numbers ought to be presented, I estimated the values out of the original graphic (with the help of a business card as a straight-edge), popped those into a spreadsheet, then graphed them with a Y-axis range of 0 to 108 million. I’ve re-graphed the points with the full Y-axis range. One can see that there is far less drama in the graph that shows the actual full range of numbers. Accepting for the sake of argument that 2011 Q2 number represents 0.33x the USA population, there is an approximate 3.1% increase in welfare recipients over the period in the graph, not the 4x visual increase suggested by the original graph. That’s actually pretty darn good, given just how awful the Bush(2) recession is.

<> 19360 5237 >

Computation &Raspberry Pi Wesley R. Elsberry on 24 Jul 2012

Raspberry Pi: More About Sound Recording

I’ve moved on to the official Raspbian release. This OS image using the hardware floating-point capabilities on board the RasPi and is noticeably faster than the Debian “squeeze” image was. It allows me to reboot when I’m powering the RasPi from my USB hub, something I couldn’t do before.

I’ve also tested a total of five different sound devices with Raspbian and ALSA for recording a mono microphone input. I’ve gotten one recording by fluke on a “Virtual 7.1 Ch Sound” device, and consistently get the claim that there is no capture device associated with the Behringer UCA202. The only device that has worked consistently for recording is a Syba “USB Stereo Sound Adapter” CMedia CM119. I didn’t pay more than $9 for any of the non-Behringer devices.

The CMedia is recognized, the controls come up appropriately in alsamixer, and arecord works without complaint on it. My only problem in simply going with this adapter is that I cannot reliably reboot my RasPi with it plugged into the USB hub. If it is plugged in on boot, the network interface throws “kevent 4″ errors. If the network is not plugged in, but the CMedia device is, ALSA throws a lot of errors at boot. Given that I want to deploy my RasPi remotely for a couple of weeks at a time, this sort of behavior doesn’t give me confidence. Things have improved since the earliest firmware I was using, but there seems to be a ways to go.

Syba SD-CM-UAUD USB Stereo Audio Adapter, C-Media Chipset, RoHS ($8.08 from Amazon)

The currently non-recording adapters:

Virtual 5.1-surround USB 2.0 External Sound Card ($1.78 from Amazon)

7.1 Channel USB External Sound Card Audio Adapter ($2.38 from Amazon)

Behringer UCA202 ($29.99 from Amazon)

Intermittently working adapter (I can’t say exactly how I managed to get one recording done with this):

Syba USB2.0 7.1CH Sound Adapter Add Stereo Output Mono Input Led ($3.28 from Amazon)

<> 21725 6614 >

Acoustics &Computation &Pocket PC &Wildlife Wesley R. Elsberry on 02 Jul 2012

Getting to an Inexpensive Audio Datalogger

Well, I spent my Saturday morning programming a C# application for Windows Mobile 5 to periodically record audio.

I was aiming to set up a data logger using the Raspberry Pi board I’ve got, but I’ve run into enough problems that I decided to look at another approach.

The idea is to log acoustic data underwater to get snapping shrimp snaps. Snapping shrimp are small crustacean predators who use a specialized claw to generate cavitation events that stun or kill their prey. Cavitation events are loud, and snapping shrimp populations are large, so a major component of the acoustic background in tropical to semi-tropical waters where there is structure is snapping shrimp snaps. These various elements come together to make snapping shrimp an excellent indicator species. The acoustic record can be used as an indicator of population health for snapping shrimp, and since snapping shrimp are metazoan predators, they indicate the health of the ecosystem.

The state of Florida has a Harmful Algal Bloom (HAB) program where monitoring stations are scattered around places. The stations have power, some have internet, and there’s space for more instruments to be loaded aboard. The regular schedule of sampling of other instruments is four times an hour. So I’m looking to sample one minute of acoustic data on each quarter hour, so my data can be correlated with the data generated by the other instruments.

The Raspberry Pi looked pretty promising as a data logging platform. It comes with an SD card slot, has an Ethernet port, and allows expansion via USB. There are three things that are holding me back on that: stable power, USB audio compatibility, and time synchronization. Getting the RasPi to power on from a cold start is a piece of cake. Getting it to reboot with “sudo shutdown -r now” is not reliable. This is likely a power interaction between my power source(s) (I’ve tried three so far) and the USB hub(s) (I’ve tried two so far). The recommended low-cost USB audio interface for Linux is a Behringer UCA202. ALSA on the RasPi, though, doesn’t think it has a capture device. The RasPi doesn’t have an RTC. This isn’t a problem with an Ethernet connection to the internet, but it is a problem if there is no connection when the RasPi boots. I’ve tried setting up GPSD with NTP to fill in when there is no network connection, but with negative results so far.

That brings me to my alternative plan. Back in 2005, Diane and I had to hurriedly design an autonomous acoustic recording system with COTS parts in order to deploy in three weeks for a field season in Wyoming. We settled on using Pocket PC devices with Core Audio’s PDAudio sound cards and A/D devices. I rigged regulated power supplies that ran off motorcycle batteries so that each unit only had to be serviced every couple of days to swap batteries and memory cards.

Since I’ve gotten my Android phone, I haven’t been using my Dell Axim X50v PDA much. I’ve done ad hoc recordings with the X50v before dropping a hydrophone over a seawall or overpass, and it’s done OK. So I started looking at audio programming for Windows Mobile devices. It was a bit tougher than it strictly needed to be. The declining market share for Windows CE/Pocket PC/Windows Mobile means that application development goes through Visual Studio 2008, not the latest development tools. (I did install SharpDevelop, but dropped that for VS2008). Audio support for Windows Mobile looks pretty minimal. There’s an interface based on the Platform Invoke Library (PIL) provided by Microsoft, and there’s the OpenNETCF library that wraps the PIL. I tried OpenNETCF because it looked simpler to implement, but I ended up with memory leaks. Using PIL directly gave me success this morning, and now I’m just letting the application record one minute of audio every five minutes as a test. The system memory report under Settings is showing stable usage of memory so far. I’m aiming to deploy the system where it will only be serviced every two weeks, so I really need to watch out for long-term problems. So far, though, it looks like I should be able to finish up with power supply issues and the acoustic gear side of things and get it installed by the time the next HAB station gets deployed. And it fits on the budget I’ve got, which is pretty close to nothing at all.

—-

I spoke a little too soon. While the periodic recording bit seems stable and I appear to have quashed memory leaks, I think I’ve got a hardware issue. I had listened to a couple of recordings that actually picked up the signal I was providing on line-in. I checked some more, and found that at some point the X50v went back to recording from its built-in microphone. That, of course, does me no good. I have tried two different cables with the same result. Usually, switching with a plug is simply a matter of physical displacement; if the plug is in, the alternative input makes no connection to the system. I’m not sure how it goes with the X50v, but I’ll probably have to disassemble it to find out.

<> 21430 5425 >

Computation &General Wesley R. Elsberry on 23 Jun 2012

Discretion is a Corporate Bad Word

Mike Dunford of “The Questionable Authority” blog relates an on-going negative experience with United Airlines. His wife is in the US military and has 15 days of leave to meet with Mike. The 15 days began when her flight arrived from Afghanistan in the USA. However, her connecting flight on United Airlines was cancelled due to fires and weather conditions that disrupted flights on the eastern seaboard. United told her that the earliest that they could book a flight for her was over 24 hours later. When you have 15 days for family leave, over a day spent waiting in a Chicago air terminal is not an insignificant hiccup.

Here’s where things got more interesting, or infuriating. Mike started looking for flights himself, and he found seats for sale on earlier flights from where she is at to where he is at. On United Airlines. He passed along the exact seat specifications to his wife, who consulted with the agents where she is at, and was told that the agents do not have access that would allow them to assign those seats without payment.

Apparently, corporations have figured out that their bottom lines are improved if the will of the soulless bean counters in corporate can be imposed without the moderating influence of the compassion of local functionaries who actually get charged with dealing with the end customer. To that end, the information technology (IT) departments get assigned to create systems that restrict the actions that the customer service agents or anyone in that entire chain of command can actually do. This certainly appears to explain the Dunfords’ poor handling by United Airlines.

Diane and I have our own data point on this phenomenon. We had some credit card debt accrued back when MBNA was a going concern. MBNA was bought out by Bank of America (BoA). Let’s say for brevity’s sake that our further experiences on that account were not pleasant. Earlier this year, we finally had the opportunity to pay off the account early. An electronic payment was set up and sent late one day. The next day, Diane tried to login to retrieve the payment records from the online system. She could not even login; the system said that there was no such account. Over the course of an acrimonious hour-and-a-half phone session with BoA, we learned a few things. Because the previous year BoA had “offered” an annual fee to go with the account that had never had one, we declined. They said that the account would be closed when the debt was settled on the account. According to BoA’s representatives, that meant when our balance payment arrived, the account was closed, and with it went our access to the online system. We explained that our only access to the records of our payments was via the online system, they said that there was nothing they could do about that. Oh, and by the way, because of the timing of our payment, there was a further finance charge that was billed to the account. How were we supposed to know about and pay such a charge if we couldn’t actually get to see our account balance? The BoA reps had no good answer on that. Could the BoA people send us our records in electronic format, just like we used to get when we had access to our account on the online system? No, they had no means of getting to a closed account themselves. I asked them what happens when law enforcement comes by with a warrant and requests the records of a closed account. They weren’t sure, they said, but in any case it wasn’t something that they could do anything about.

Now, on any scale of evil, BoA is certainly going to be found to be headquartered on a lower circle of Hell than United Airlines. But the same impetus and mechanism of corporate skin-flinting can be seen in play in both. Perfectly personable customer service representatives are forced into frustrating the end customer in order to uphold corporate policy. The effect of frustrated customers is assumed to either be negligible or to be outweighed by the savings the corporation achieves by denying customers whatever might be sought. The only way that this will change is if we frustrated consumers can figure out how to change that economic assessment. We need to identify the corporations that remove discretionary power from their customer service people and give our custom to corporations who leave discretion to their customer service agents. This is not a simple task, and that’s what those soulless bean counters are relying upon.

<> 19776 5067 >

Computation &FreeBSD Wesley R. Elsberry on 21 Jun 2012

FreeBSD: Good-bye, md5crypt

The author of “md5crypt” considers it no longer safe for use in password encryption. This affects various *BSD systems, including FreeBSD, since md5crypt was long the default encryption applied to passwords in the system. Now, though, md5crypt is susceptible to brute-force attacks using GPU hardware that makes breaking an 8-character password something that can be done in a couple of days. Some recent security failures around the internet are now attributed to breaking of md5crypt password systems.

To find out if your *BSD system needs to be changed, do the following:

grep passwd_format /etc/login.conf

If the line returned by that includes “md5″, you have a problem. (If it says “des”, you’ve had a big problem for a long time.)

If you have a problem, do the following:

su

vi /etc/login.conf
/passwd_format

Change “md5″ to one of the newer encryption methods, like SHA (sha256 or sha512) or Blowfish (blf).

:wq

cap_mkdb /etc/login.conf

exit

Then change at least the root password and the password for everyone in “wheel” group. New passwords and changed passwords will be stored with the new default encryption. You can verify this by looking at the password hashes in /etc/master.passwd.

<> 18906 5052 >






Support This SiteCafePress Shop
The Austringer © 2013 |ShadedGrey made free by Web Hosting Bluebook