Category ArchiveScience
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.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 4264 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 501 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>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.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 75807 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 5705 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>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.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 90605 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 6300 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>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.
- """
- popdyn.py
- Trying out population dynamics in Python.
- Wesley R. Elsberry
- """
- class LMatrix:
- """
- LMatrix
- A support class for Leslie and Lefkovitch matrix use for
- population dynamics.
- This is a generic class that allows for an arbitrary number of age
- classes or stages.
- """
- def __init__(self,stAges):
- import numpy as num
- import numpy.matlib as M
- from numpy.matlib import rand,zeros,ones,empty,eye
- import interval
- """
- In either Leslie age-structured or Lefkovitch stage-
- structured population modeling, the central feature
- is a special matrix representing both fecundity of
- ages/stages and survivorship in each age/stage.
- The Leslie age-structured matrix is slightly simpler,
- since each iteration moves the population forward
- by a time step equal to the difference between the
- age classes.
- The Lefkovitch stage-structured matrix,
- on the other hand, may have unequal times spent in
- each stage, and thus other elements of the matrix
- represent the fraction of individuals that continue
- to remain in the stage per time step of the model.
- Those lie on the main diagonal.
- The matrix in either case is an N-by-N matrix, where
- N is the number of ages or stages (stAges parameter).
- Because most values in the matrix are zero, we'll
- start with that.
- """
- self.stAges = stAges # Keep track of how many age/stage classes there are
- self.m = zeros((self.stAges,self.stAges))
- self.step = 0 # We are at the beginning
- self.popvec = None
- self.survival = None
- self.recurrence = None
- self.fecundity = None
- def LM_AddFecundity(self,fvector):
- """
- Method to set fecundity values for an LMatrix.
- This is done by setting the first row of the
- matrix to the values in the vector.
- A mismatch between the length of the vector and
- the width of the matrix leaves both unchanged.
- """
- if (fvector.shape[0] == self.stAges):
- # Just replace the row
- self.m[0] = fvector
- # Save it in the object
- self.fecundity = fvector
- else:
- print "Mismatch in size: %s vs. %s" % (self.stAges - 1,fvector.shape[0])
- def LM_AddSurvival(self,survival):
- """
- Add the values for survival that shift population members
- from one age/stage to the next.
- The values come in as the "survival" vector, a Numpy array.
- They replace values in the m matrix in the diagonal from
- [1,0] to [N-1,N-2].
- """
- if (survival.shape[0] == (self.stAges - 1)):
- for ii in range(1,self.stAges):
- self.m[ii,ii-1] = survival[ii-1]
- # Save it in the object
- self.survival = survival
- else:
- print "Mismatch in size: %s vs. %s" % (self.stAges - 1,survival.shape[0])
- def LM_AddRecurrence(self,recur):
- """
- Add the values for survival of organisms remaining in the same
- stage. This is for stage-structured population models only.
- The input is as the vector recur, and its values replace those
- in the m matrix along the main diagonal from [1,1] to [N-1,N-1].
- """
- if (recur.shape[0] == (self.stAges - 1)):
- for ii in range(1,self.stAges):
- self.m[ii,ii] = recur[ii-1]
- # Save it in the object
- self.recurrence = recur
- else:
- print "Mismatch in size: %s vs. %s" % (self.stAges - 1,recur.shape[0])
- def LM_SetOneRelation(self,fromState,toState, value):
- """
- Method to set a relation that does not fall on the survival
- diagonal or the recurrence diagonal. This is useful for more
- complex stage-structured population modeling where organisms
- from one stage may graduate to multiple other stages at defined
- rates.
- """
- iv = interval.Interval.between(0,self.stAges-1)
- if ((fromState in iv) and (toState in iv)):
- print self.m
- self.m[toState,fromState] = value
- print self.m
- def LM_SetPopulation(self,popvector):
- """
- Another central feature of these models is that the size
- of the population is kept in a 1xN column vector. For the
- implementation here, the actual representation is as a
- Numpy array, which has no column vector as such. This will
- be handled in the actual stepping method.
- """
- if (popvector.shape[0] == (self.stAges)):
- self.popvec = popvector
- else:
- print "Mismatch in size: %s vs. %s" % (self.stAges,popvector.shape[0])
- def LM_StepForward(self):
- """
- Do the matrix multiplication to obtain the new population
- vector. Retain the previous population vector.
- Handle turning population vector into a column vector for the
- multiplication.
- """
- # Convert the population array to a Numpy matrix and transpose it
- # to get the column vector we need. Multiply the L* matrix by
- # the column vector, resulting in a new column vector with the
- # population at the next step.
- nextpopvec = num.mat(self.m) * num.mat(self.popvec).T
- # Save the old population vector
- self.lastpopvec = self.popvec
- # Replace the population vector with the new one, which means
- # transposing it and converting to Numpy array type
- self.popvec = num.array(nextpopvec.T)
- # Track the number of steps taken
- self.step += 1
- def LM_TotalPopulation(self):
- """
- Return the total population size. Sums the "popvec" vector.
- """
- if (None != self.popvec):
- # Population vector as array multiplied by column vector of 1s is a sum
- t = num.mat(self.popvec) * ones(self.stAges).T
- return t[0,0]
- else:
- return 0.0
- if __name__ == "__main__":
- """
- Generic initialization suggested at
- http://www.scipy.org/NumPy_for_Matlab_Users
- """
- # Make all numpy available via shorter 'num' prefix
- import numpy as num
- # Make all matlib functions accessible at the top level via M.func()
- import numpy.matlib as M
- # Make some matlib functions accessible directly at the top level via, e.g. rand(3,3)
- from numpy.matlib import rand,zeros,ones,empty,eye
- # Define a Hermitian function
- def hermitian(A, **kwargs):
- return num.transpose(A,**kwargs).conj()
- # Make some shorcuts for transpose,hermitian:
- # num.transpose(A) --> T(A)
- # hermitian(A) --> H(A)
- T = num.transpose
- H = hermitian
- import interval
- # Check it against an existing example data set
- # http://www.cnr.uidaho.edu/wlf448/Leslie1.htm
- ex1 = LMatrix(4)
- fex1 = num.array([0.5, 2.4, 1.0, 0.0])
- ex1.LM_AddFecundity(fex1)
- sex1 = num.array([0.5, 0.8, 0.5])
- ex1.LM_AddSurvival(sex1)
- pex1 = num.array([20, 10, 40, 30])
- ex1.LM_SetPopulation(pex1)
- print pex1
- print ex1.m
- ex1.LM_StepForward()
- print ex1.popvec
- # It checks out!
- # Another example, this time of a stage-structured population
- # http://www.afrc.uamont.edu/whited/Population%20projection%20models.pdf
- ex2 = LMatrix(3)
- fex2 = num.array([0.0, 52, 279.5])
- ex2.LM_AddFecundity(fex2)
- sex2 = num.array([0.024, 0.08])
- ex2.LM_AddSurvival(sex2)
- rex2 = num.array([0.25, 0.43])
- ex2.LM_AddRecurrence(rex2)
- pex2 = num.array([70.0,20.0,10.0])
- ex2.LM_SetPopulation(pex2)
- print pex2
- print ex2.m
- ex2.LM_StepForward()
- print ex2.popvec
- print ex2.LM_TotalPopulation()
- ex2.LM_StepForward()
- print ex2.LM_TotalPopulation()
- ex2.LM_StepForward()
- print ex2.LM_TotalPopulation()
- for ii in range(22):
- ex2.LM_StepForward()
- print ex2.popvec
- # Tests OK!
Output from the standalone run:
- [20 10 40 30]
- [[ 0.5 2.4 1. 0. ]
- [ 0.5 0. 0. 0. ]
- [ 0. 0.8 0. 0. ]
- [ 0. 0. 0.5 0. ]]
- [[ 74. 10. 8. 20.]]
- [ 70. 20. 10.]
- [[ 0.00000000e+00 5.20000000e+01 2.79500000e+02]
- [ 2.40000000e-02 2.50000000e-01 0.00000000e+00]
- [ 0.00000000e+00 8.00000000e-02 4.30000000e-01]]
- [[ 3835. 6.68 5.9 ]]
- 3847.58
- 2093.1914
- 5811.535142
- [[ 19837904.89838918 393232.36554185 30519.85368983]]
Acoustics &Computation &Electronics &Raspberry Pi &Science &Wildlife Wesley R. Elsberry on 02 Jun 2012
Not Everything is Easy in the Land of Raspberry Pi
I had the chance to work with my Raspberry Pi some more late last night and this morning. Quite a lot of stuff works, given that the board design is essentially at a state of “ready for the software developers to do their thing”. But some things are not quite there, or behave oddly.
My first boot-up that I talked about was on a bench without networking. That turns out to be significant. When I tried to run my RasPi with the full load of peripherals in the USB hub and also have the wired Ethernet on, I got a lot of “kevent 4 may have been dropped” error messages and no network connection. The canonical answer on the RasPi forum is that this is a power supply issue, where marginal power to the board means there isn’t enough to properly run the Ethernet circuitry. Some respondents have noted that their circumstances don’t fit into that neatly. I suspect that I may be joining them, but I have some more experimentation to do before saying so categorically. My get-it-working solution so far is to run the RasPi off a dedicated power supply and have all the peripherals on a powered hub. This isn’t ideal for something I hope to deploy remotely. I need to figure out really reliable, comes-up-on-power-on every time configurations.
I spent entirely too much time dealing with something that I should have caught early. The RasPi is a UK invention, and its default settings are convenient for people in the UK. I have a firewall here, and I set my RasPi to enable SSHD so I could login over the net. I logged in from an Ubuntu box and changed the “pi” user password to something approaching a strong password, you know, one with odd case, numbers, and symbols. That’s all to the good, but then I rebooted and ran into the network interface being offline. Fine, I thought, I’ll login directly. But I couldn’t, because no matter what I did, I could not generate one of the symbols in the new password from the directly-connected keyboard, not even with alt-codes. Stripping the RasPi down to just power and network allowed it to boot and establish the network interface, and I could login once again from a remote computer. I changed the password to avoid the bad symbol and worked on localization. The involves “dpkg-reconfigure” applied with three different targets, the keyboard, the locale, and the timezone.
I’ve been able to install a batch of additional software. I installed Cmake and libncurses5, then tried building Avida on the RasPi. The Avida build doesn’t get far. tcmalloc apparently is known to have build issues on ARMv6, plus multiple classes got an “out of virtual memory” error. That still holds with the boot switched to the 224MB main memory setting. But python-scipy and python-gps installed without issues. I even installed VLC to check if the final piece of a media center was anywhere close to done. While the VLC and its dependencies went on without complaint, plugging in a USB DVD drive and pointing VLC at it did not go much of anywhere. There was no continuous playback, and if I changed the media pointer, it would display a single frame. I think that the color rendition was off, but I had plugged in a movie that I hadn’t watched yet, so it is just possible that the cinematographer thought a strange palette would be a good thing.
I tried out my USB GPS dongle. I installed “gpsd-clients” and ran cgps, which reported … absolutely nothing. That was disappointing. I plugged the GPS into my Ubuntu box, and cgps happily displayed a fix and chatter from the dongle. I went back to the RasPi, stopped gpsd, then used gpsmon. That displayed a fix and messages from the dongle. So I’m not sure why gpsd on the RasPi is doing things differently than on the Ubuntu box.
For those pulling up “Geany” to do some Python scripting, you’ll need to change the preferences so that the terminal of choice is not “xterm”, but rather “lxterminal” (this is for Debian Squeeze).
That’s it for now. I’m expecting to have to repeat this process whenever a new version of the operating system is released, so a set of notes on what gets done seems in order.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 21620 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 5790 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Notes on RasPi
Adding nameservers:
sudo nano /etc/resolv.conf
nameserver 4.2.2.2
nameserver 4.1.1.1Localization:
sudo dpkg-reconfigure keyboard-configuration
sudo dpkg-reconfigure locales
sudo dpkg-reconfigure tzdataAdditional python modules:
sudo apt-get install python-scipy
sudo apt-get install python-gpsWiFi dongle —————————————–
See http://elinux.org/RPi_PeripheralsAdd to /etc/apt/sources.list:
deb http://ftp.us.debian.org/debian squeeze non-freeThen
sudo aptitude update
sudo aptitude install firmware-atheroscd /lib/firmware
sudo wget http://wireless.kernel.org/download/htc_fw/1.3/htc_9271.fw
sudo wget http://wireless.kernel.org/download/htc_fw/1.3/htc_7010.fw
Acoustics &Computation &Science &Wildlife Wesley R. Elsberry on 31 May 2012
Raspberry Pi First Run
I checked the UPS tracking number periodically today. My Raspberry Pi was marked as delivered at about 2:30 today.
When I got home, I found the package. I still needed to prepare the SD card, so I brought up the RasPi Wiki instructions for SD card setup and went with the Debian Squeeze distribution to start with. While “dd” was doing its thing, I was preparing other things.
The LCD monitor I want to use needed to have its built-in stand removed. There wasn’t room to attach the HDMI cable to the HDMI to DVI adapter and fit that to the while the stand was on.
I located a USB keyboard and trackball. I also found a USB trackpad.
Back to the Ubuntu box and the SD card. I went through the steps to resize the SD card partition with parted. I got some weird messages from the two steps following parted, but apparently one other step was needed: remove the SD card and reader, then plug it back in. With that done, the SD card looked to be in good shape.
I unpacked the USB hub and plugged in power. I hooked up the USB Y cable to the USB to Micro B cable and the hub. I plugged the keyboard and trackball into the hub.
Then I opened up the RasPi package. The package held a packing list (one RasPi, of course), a “Getting Started” single sheet document, and a plain cardboard box. The RasPi was in an antistatic sleeve in the box. It came out, and I started hooking things up.
The SD card holder gave me pause. There’s a gold-plated bar that the card meets, and it took me a moment with a magnifying glass to make sure that it was intended to move when the card was inserted. It looks to be a switch arrangement to indicate the presence of a card.
Then the HDMI cable went in. The monitor changed from its “no signal” display to a blank black screen.
I hooked up a USB data cable between the RasPi and the USB hub.
Then I plugged in the power. There was about a three-count before the monitor started displaying the initial boot-up screen. Things proceeded nicely from there.
The RasPi all hooked up.
Here’s the USB hub and a couple of USB peripherals of interest, an audio interface and a GPS.
And here is the RasPi system hooked up and driving the monitor, showing the default X Windows desktop.
The RasPi doesn’t like my Logitech USB trackball, but it works fine with a trackpad. I’m having some trouble with the keyboard, but I expect that it is the keyboard’s fault. These accessories are pretty ancient by computer standards.
It’s a bit disappointing that the USB WiFi adapter that I have on hand doesn’t seem to be working with the system. I’ll give it another try before moving on to other stuff. That means I’ll need to put the RasPi setup where I can run a physical Ethernet cable.
Looking at dmesg, both the GPS and the audio interface appear to be recognized OK. That’s about as far as I’ve gotten on that.
The word is that the platform I’d like to deploy on won’t go out for two to four weeks, so I have a little time to organize and develop a RasPi-based data collection system. The first step went nicely enough that I’m hopeful about the rest.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 20548 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 5654 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Florida &Law and Politics &Science &Wildlife Wesley R. Elsberry on 30 May 2012
Official Interference in Biology
We’ve heard tales of officialdom greasing the way for people to profit over the consideration of species and ecosystems. Now we’ve got a home-grown Florida tale along those lines.
Craig Pittman wrote an article appearing in the Tampa Bay Times that goes into the details. Department of Environmental Protection employee Connie Bersok has been suspended from her position by her supervisor, Jeff Littlejohn, for failing to approve an application giving a lot of wetlands restoration “credits” to developer Marc El Hassan’s mitigation bank. According to the article, Littlejohn’s basis for doing so is material given to him by the mitigation bank’s lawyer and its consultant. If your blood pressure is trending a bit low, please go read the article and you’ll likely find it heading right back up again.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 10471 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 2900 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Computation &Electronics &Science Wesley R. Elsberry on 29 May 2012
Raspberry Pi On Its Way
I got email from Newark today saying that they had shipped my Raspberry Pi. I should get it this week.
They also sent an invoice, having charged my credit card. The item itself is $35.00, shipping is $5.00, and tax is $2.28, for a total of $42.28. Way back in early March, I called Newark to place my order since someone noted that the huge shipping charge they were quoting at the time could be avoided with a phone order rather than an online order. Hopefully they’ve fixed the online ordering since then.
Otherwise, I think that I have enough RasPi accessories to get started with when it arrives. I picked up a used Tektronix oscilloscope and an LCD monitor with DVI interface from Mario DeSario at Audio Workshop in Bradenton, Florida. I have a HDMI to DVI adapter and an HDMI cable. I have a 2.5 amp powered USB hub to supply the RasPi and allow me to plugin more accessories. I’ve got a USB GPS and a USB sound interface. I’m looking forward to diving in on this.
I also saw on the RasPi forums that by installing Mono, a RasPi can run executable files produced in managed .NET code from Visual Studio. That is a cool capability. I might try doing the monitoring system software in C# and .NET.
I still need to do some work on the hydrophone side of the system. I want to do a bit of home-brewing there. Years ago, I heard Cornell’s Chris Clark talk about fabricating in the field what he called a “schlong-o-phone”, which was basically a microphone capsule potted in epoxy in a convenient flexible cylindrical latex mold, otherwise known as a condom. Some of the more convenient materials for filling a mold don’t actually work well for salt-water and electronics. For example, most RTV (silicone) formulations are waterproof in themselves, but do not bond well to cable insulation. Additionally, the relatively high viscosity means that best results require applying a vacuum to de-gas an RTV mold, and that’s outside my current state of gear. I’m going to experiment with a piezo disk and Plasti-Dip. I’ve priced urethane for molds, and it is indeed expensive, but it is also low viscosity (no bubbles in the mold) and should bond nicely to cable insulation. If the Plasti-Dip results are bad, I’ll likely give the urethane a try.
Checking stuff out will require at least a couple of the home-brew hydrophones, our trusty frequency generator, and the oscilloscope. I have a variety of pre-amp and amplifier DC-powered circuits to pair up with the hydrophones.
Something I’ve wanted to try out for years now is doing a reciprocity calibration, but I’m not quite there yet, either. Reciprocity calibration uses three transducers (whose characteristics may all be unknown) and yields an absolute calibration of a receiving transducer. If a transducer can serve for both receive and projection on short time scales, a self-reciprocity calibration can be done. In either method, precision measurement of the current going to the projector in the system is necessary. That’s the part that is most challenging. There are plenty of other challenges, though. For hydrophones, the distance between all the transducers needs to be enough to be in the far field, where spreading loss is predictable. At least a meter to 1.5 meters is what would serve as a minimum. Then, one needs to be far enough away from either the water surface or any other obstacles so that the calibration signals aren’t bouncing off other things and giving reverberent noise that would compromise the received energy levels. 1.5 meters distance from other surfaces would give about a millisecond’s worth of unblemished sound. So we’re talking a quiet body of water at least 4.5 meters wide by at least 3 meters deep just to get a millisecond of calibration data at a time. I think I’ll have to defer home-brew reciprocity calibration for a later date.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 8189 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 2277 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Acoustics &Science &Wildlife Wesley R. Elsberry on 14 May 2012
Personal Research and the Budget
Diane and I are working on a personal project to put together an acoustic sampling system that could yield information about the activity levels of snapping shrimp. Whitlow Au and his group have done this sort of thing out in the Pacific. Of course, they’ve gotten research funding to do it. We’re looking to do this out of our pockets, at least for the first proof-of-concept.
Snapping shrimp are small crustaceans. They stun their prey using an oversized claw. Well, that’s just half the story. Any crustacean with a claw might grab or bonk a prey item using a claw. Snapping shrimp create a cavitation event with a snap of their claw. The resulting burst of acoustic energy is a natural disruptor beam (obligatory SF reference can be checked off now). There’s some cool high-speed video of snapping shrimp doing their thing that got published some years back.
Those cavitation events are loud. Until human shipping noise is added to the picture, the single biggest item in the tropical to semi-tropical littoral marine acoustic environment is energy from snapping shrimp snaps. Part of the challenge for my dissertation work on dolphins clicks was coding a recognizer that would include dolphin clicks but exclude snapping shrimp snaps.
Because their method of prey capture produces a signal that travels significant distances, their activity can be tracked for a particular location just using acoustic recording. Because snapping shrimp are so widely distributed and so abundant anywhere there is structure in the (relatively shallow) marine environment, this can be done just about anywhere of interest: seagrass beds, reefs, mangrove swamps, etc.
We’re thinking of snapping shrimp as an indicator species. The various factors of their life history and acoustic features makes them well-suited for this role. A drop in snapping shrimp activity that doesn’t fit the usual diurnal and seasonal patterns would be taken as an indicator of declining ecosystem health.
But to get there, we have to be able to sample those acoustics. This is a job that we’re hoping to accomplish with an instrument we’ve budgeted $200 for parts. This is pretty much penny-pinching taken to an extreme. Here’s the basic gist of where we’re going.
We’re hoping to base the instrument on the new Raspberry Pi platform. This ARM-based Linux system comes with an SD-card interface plus USB. It doesn’t come with a clock. For places with a network connection, NTP can handle setting the time. For other places, we’re hopeful that a cheap USB GPS dongle will serve to provide both time and location. The RasPi also has no sound input, so a USB sound interface is needed. The RasPi needs a power supply, as do whatever USB devices we want to use, so a powered USB hub seems the best solution. We’ll need a hydrophone. That’s something we can make out of a piezo disk, cabling, and some waterproofing method (epoxy, urethane, or perhaps even Plasti-Dip). And that will need a preamplifier. This is where we might bust our budget.
The RasPi is $35. The GPS with USB is $28. The sound interface is $29. The powered USB hub is $27. A piezo disk is about $0.50, and the Plasti-Dip for it might cost a buck.
Some time back, Diane worked with engineers at the University of Texas at Austin’s Applied Research Lab on a dolphin biosonar project. They set out to make a preamp that would provide flat response from a few kilohertz up to two megahertz. The result was a circuit they called the Universal Dolphin Preamplifier. Depending on the discrete components on the circuit, it could be configured for 0, 20, or 40 dB of gain. Even though our first pass at an instrument would be strictly human audio range, I had hoped to be able to construct one of these preamplifiers for use in the project. That was before I started pricing the integrated circuits used in it. There are three of them, and the prices are $37, $16, and $13. All told, I’m estimating about $86 for the cost of parts for one preamplifier circuit. Instead, I’ll be looking to use a more common — and cheap — audio-range preamplifier for our first instrument to deploy.
There are some other things that would be useful to add that may not make it, like some sort of LCD panel to indicate system status. We may just go with some LEDs.
There are consequences of being cheap. The peak frequency of the broadband transient that is a snapping shrimp click is upwards of 50kHz. There’s energy at frequencies within the human audio range, so recording at that range will allow detection of snapping shrimp clicks, but not any sort of spectral analysis that would mean anything. That means just getting measures of activity, like number of detectable clicks. Recording a single point likewise doesn’t tell us much about spatial distribution of snapping shrimp being recorded. We might group clicks by relative received amplitude as a proxy for distance from the hydrophone. And because we’ll deploy an uncalibrated hydrophone, we won’t be getting absolute amplitudes out of the samples, everything will simply be relative.
Doing this for the maximum amount of information would thus imply use of calibrated hydrophones, multiple hydrophones to allow for acoustic localization, and sampling rates high enough to capture the full frequency range of snapping shrimp clicks. A calibrated hydrophone from a vendor could easily run over $1000 each. A system for recording four simultaneous channels of acoustic data at up to 500 kilosamples per second could be done for about $1000 using the Tern Micro GR4 ADC units and a microcontroller. That complete system could easily run between $6000 and $10000 all told. So for the moment we’ll stick with the limitations of doing science on a shoestring budget.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 6920 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 1994 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Acoustics &Computation &Science Wesley R. Elsberry on 31 Mar 2012
Python and the STFT
I’ve been going through biosonar data and while the SciPy specgram method is serviceable, I was interested in a short-time Fourier transform (STFT) implementation. There are a couple of ad hoc routines on Stack Overflow and the like, but I’ve started off with the Google Code PyTFD module. There are others out there as well, at least two projects including an STFT implementation are aimed at extracting time and frequency data from musical recordings. I may have a look at one or both of those at some point.
In any case, installing PyTFD involves downloading the code via Subversion and then running the setup.py script.
Since I spent more time than I think was absolutely necessary getting a couple of examples done with the STFT, let me run through an example in the hopes that helps somebody.
- # Imports
- from __future__ import division
- from pytfd.stft import *
- from pytfd import windows
- import numpy as np
- import numpy.fft as nf
- import matplotlib
- matplotlib.use('Agg')
- import scipy
- import scipy.signal as spsig
- import pylab
- from pylab import *
- # [...]
- w = windows.rectangular(8)
- Y_stft = stft(clkdata,w)
- extt = [0,Y_stft.shape[0]*1e-6,0,5e5]
- pylab.imshow(abs(Y_stft)[Y_stft.__len__()//2:],
- extent=extt,
- aspect="auto",
- origin="upper")
OK, so there’s a fair amount of things to be imported along the way. The first three items (lines 2 to 4) are specifically for setting up access to PyTFD’s STFT method. Line 18 sets up the window function to use in the STFT. Line 19 actually does the work, getting the resulting multidimensional Numpy array with the STFT result given a Numpy array input and the window.
Line 20 sets up the extent array to express the size of the X range and the Y range covered by the STFT. Lines 20 to 24 puts the result in a subplot. There are some issues there. The STFT results are essentially a whole series of Fourier transforms, and those have both negative and positive frequencies, and are complex values to boot. So the “abs” function provides a magnitude for each point. The slice yields just the positive frequency range. Then the extent gets set to the range represented by the STFT. The “aspect” parameter is set to “auto” so that the X and Y ranges can be calculated separately by Matplotlib. The “origin” is set to “upper” to put the frequencies in the expected orientation.
Here’s a couple of the outputs:


Education &Science Wesley R. Elsberry on 04 Mar 2012
A Brief Monty Hall Problem Digression
At lunch at the Spoonbill Bowl on Saturday, I was privileged to volunteer with a group of students, faculty, and researchers. It was a long day. Lunch was provided, and I got to sit down with a colleague and a couple of faculty members from USF St. Petersburg. One of them posed a brain-teaser question. I followed up with broaching the Monty Hall problem.
Just to make sure everyone is on the same page, I’ll briefly describe the Monty Hall problem. In the television game show, “Let’s Make a Deal”, host Monty Hall would offer a contestant an opportunity to win a major prize, let’s say a new automobile. The stage would show three doors (“Door #1″, “Door #2″, and “Door #3″). The major prize is behind one of the doors. Behind the other two are booby prizes, let’s say that they are goats. The contestant is allowed to pick a door. Rather than simply opening the contestant’s pick, Monty would have a door the contestant did not pick opened to reveal a goat. Then, Monty would offer the contestant a choice: she could stay with her original pick, or she could switch to the other door that had not been opened.
The Monty Hall problem poses the question of strategy: Is it better to always stay with the original choice, to always switch to the other remaining door, or does it not matter one way or the other? This question was posed many years ago in a column hosted by Marilyn Vos Savant and gave her months of correspondence as people argued with her advice to always switch. Marilyn was right, of course. The problem and just how counterintuitive the result is has proven a popular topic since then, and Jason Rosenhouse even has authored a book about it.
Back to my luncheon discussion. Me bringing up the Monty Hall problem led to about twenty minutes of trying to explain to one of my lunch companions why always switching was the right choice. It was a microcosm of the entire history of the public history of the problem, and I found it frustrating that I wasn’t able to more clearly and simply put it so that my companion could be convinced of the correctness of the answer. What finally made sense to my companion was that if one enumerated all the permutations, staying won in one-third of them, and switching won in two-thirds of them.
So I decided that I would make up a set of business cards to make future discussions of the Monty Hall problem go faster. Here is my graphic:

While I can’t include all the text that I would like on something the size of a business card, I can use this to quickly demonstrate why switching is actually the better strategy. The card shows all nine possible ways that the game can be played. It also shows that in only three of those does staying with the initial pick work out to a win for the contestant. In the other six ways the game works out, the contestant only wins if they switched.
I think I’ll put a version on a T-shirt.
Update: During lunch today, I tested out my card as a tool on a Monty Hall Problem-naive colleague. Her initial hunch was that staying with the initial choice was the strategy to pursue. I said that I would try to convince her that switching was the correct strategy and produced a card. I pointed out that every possible way the game could go was represented, and in only the top row did staying work out to a win. Within two minutes, I had convinced her of the correctness of the switching strategy. So that’s one data point.
Also, I’ve updated the graphic here. I’ve changed the color scheme. Diane pointed out that it would be hard for color-blind people to distinguish differences in the original. I’ve also added door numbers to make it clearer that each block of three rectangles represents one set of doors. And I added drop shadows to the doors just because I think it looks better that way.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 3188 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 1191 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Science Wesley R. Elsberry on 28 Feb 2012
Biological History: Strickland on Zoological Systematics
In looking at the Wallace biogeography flap, I came across an interesting passage in Wallace’s 1855 Sarawak paper:
We shall thus find ourselves obliged to reject all those systems of classification which arrange species or groups in circles, as well as those which fix a definite number for the divisions of each group. The latter class have been very generally rejected by naturalists, as contrary to nature, notwithstanding the ability with which they have been advocated; but the circular system of affinities seems to have obtained a deeper hold, many eminent naturalists having to some extent adopted it. We have, however, never been able to find a case in which the circle has been closed by a direct and close affinity. In most cases a palpable analogy has been substituted, in others the affinity is very obscure or altogether doubtful. The complicated branching of the lines of affinities in extensive groups must also afford great [[p. 188]] facilities for giving a show of probability to any such purely artificial arrangements. Their death-blow was given by the admirable paper of the lamented Mr. Strickland, published in the ‘Annals of Natural History,’ in which he so clearly showed the true synthetical method of discovering the Natural System.
Hmmm, OK. What are the odds that one could manage to lay hands on a paper published about 172 years ago? Google search for “Annals of Natural History Strickland” placed an Internet Archive link high in the ranking. That page offers the text of the paper in several different formats.
So what does Mr. Strickland say about systematic work?
The postulate with which I commence the inquiry is, to let
it be granted that there are such things as species, distinct in their characters and permanent in their duration. This being admitted, we define the natural system to be the arrangement of species according to the degree of resemblance in their essential characters. In other words, the natural system is that arrangement in which the distance from each species to every other is in exact proportion to the degree in which the essential characters of the respective species agree. Hence it follows that the whole difficulty of discovering the natural system consists in forming a right estimate of these degrees of resemblance. For the degree in which one species resembles another must not be estimated merely by the conspicuousness or numerical amount of the points of agreement, but also by the physiological importance of these characters to the existence of the species. On this point no certain rules have yet been laid down ; for though naturalists in general admit, for instance, that the nervous system is superior in importance to the circulatory, and the latter superior to the digestive system, yet this subject is still in a very indeterminate state, and until our knowledge of physiology is much further advanced, disputes will always arise respecting the true position of certain species in the natural classification. Such differences of opinion, however, will continually diminish as our knowledge increases, and they are even now very few in comparison with the numerous facts in classification on which all naturalists are agreed. Much may be effected by education and habit, which impart to the naturalist a peculiar faculty (termed by Linnaeus a ” latent instinct 5 ‘) for appreciating the relative importance of physiological characters to the satisfaction of himself and others, even in cases where he is unable to explain the principles which determine his decision.
Strickland devotes the bulk of his paper, though, to a thorough trashing approaches to systematics that proposes some ordering principle from without. Linear arrangements, numerological arrangements, and circular arrangements all come in for deconstruction and dismissal.
The best part I see, though, is Strickland’s argument for why variety is and must be the aspect of nature that zoologists simply have to accede to.
2. It follows from the irregularity of external nature, as seen on the surface of the earth, that the groups of organized beings must be irregular also, both in their magnitudes and in their affinities. In proof of this it must be granted that the final cause of the creation of every animal and plant is the discharge of a certain definite function in nature, and not the mere occupation of a certain post in the classification : in short, that the design of creation was to form not a cabinet of curiosities, but a living world. Few, I trust, would hesitate to admit this proposition. If, then, the different modifications of structure which constitute the characters of groups were given solely with reference to the external circumstances in which the creature is destined to live, it follows that the irregularities of the external world must be impressed upon the groups of animals and of plants which inhabit it. The supply of organic beings is exactly proportioned to the demand ; and Nature does not, for the sake of producing a regular classification, go out of her way to create beings where they are not wanted, or where they could not subsist. Thus, for instance, the warm climate and varied soil of the tropics admits of the growth of a vast variety of flowers and fruits. The group of Humming-birds which feed on the former, and of Parrots which feed on the latter, are accordingly found to be developed in a vast variety of generic and specific forms ; while the family of Gulls which seek their food in the monotonous and thinly inhabited regions of the north, are few in species and still fewer in genera. Again, the variety of plants in the tropics admits the existence of a great variety of insects, and the family of woodpeckers is proportionately numerous; while the Oxpecker {Buphaga) % which seems to form a group fully equivalent in value to the Woodpeckers, is limited to but one or two species, because its food is confined to a few species of insects which only infest the backs of oxen.
It follows, then, that the groups of organized beings will be great or small, and the series of affinities will be broken or
continuous, solely as the variations of external circumstances
admit of their existence, and not according to any rule of
classification. If, indeed, we were to imagine a world laid
out with the regularity of a Chinese garden, in which a certain number of islands agreeing in size, shape, soil, and form of surface, were placed at exactly equal distances on both sides of the equator, we might then conceive the possibility of a perfect symmetry in the groups of beings which inhabit them ; but without some such supposition, I do not see how a class of animals or plants can be symmetrical in themselves, and yet be expressly adapted for conditions of existence which are eminently irregular.
This statement of Strickland’s appears to express the concept of niche that Joseph Grinnell would be credited with some sixty-seven years later in 1917. There is the persistent difficulty in looking at almost all Victorian-era naturalist writings pre-Origin-of-Species that everything has to be couched in terms of some sort of creationary framework. But the citation of Strickland in Wallace’s 1855 paper does show a nice progression in the history of ideas, where a concept of dependence of a species on a set of environmental conditions leads to the concept of biogeography relating species not just to particular constraints, but also to particulars of place and time in relation to parent and daughter species.
The particular proposal of Strickland’s, to evaluate characters weighted in some way by importance to the species in order to assess affinities to other species, markedly differs from what is considered current today. The cladistic approach developed in the 1960s explicitly gets rid of “weighting” schemes and the notion that a few well-understood characters are better for assessing affinity than many characters simply noted as present or absent. So Strickland’s actual proposal of what the true method of discovering the natural system would be hasn’t held up, but several of his reasons for rejecting prior methods still carry weight, and his expression of this appears to have contributed to the development of biogeography as a topic.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 1597 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 675 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Acoustics &Computation &Science Wesley R. Elsberry on 19 Feb 2012
Some Data Analysis and Visualization
As noted here before, I’m working through refreshing archived data, mostly from CD-ROM media. I’ve run into a whole batch of CD-ROM disks that are in good physical condition, but which mostly cannot be read. I’m trying some tools that I’ve seen recommended, but would be open to suggestions.
But the whole point of getting the archived data refreshed is to do something with it. And that’s what I will aim to discuss here this time.
Over several years, there were a number of different technologies I was using to collect bioacoustic data. This means that I don’t have one single type of data of interest. I have data that was recorded on audio cassette tape. I have data from a Racal Store V data recorder that was transferred to cassette tape. I have digital data from Keithley-Metrabyte DAS-1800 DAQ, Tucker Davis Technologies DAQ, and a couple of different National Instruments DAQ boards multiplied by at least two different multichannel scenarios. Plus, there’s digital data transferred off of a Racal Storeplex unit via SCSI. There’s mixed endian byte order issues, among other things.
I have a good software solution for two of these particular data acquisition scenarios. I wrote that between 1999 and 2001 using Borland’s Delphi 5. In all, there’s about 60,000 lines of code for data acquisition, reduction, analysis, and visualization. The original can handle multi-channel recordings taken from a single National Instruments board. A variant works on digitized audio recordings. That includes interactive data reduction with an automated click-picker whose choices can be refined with changes in parameters or by interaction with an oscillogram graph.
That still leaves a lot of data waiting for analysis. During my time at Michigan State University, I got into Python programming. There are a number of nice things about going after the rest of the data with Python. A big one is that Python is free, open-source software. I can have colleagues install it and not have to worry about breaking their budgets, which is a concern when one considers the well-established science and engineering scripting platform, MATLAB. While Python doesn’t yet have all the “toolbox” capability of MATLAB, it has enough to move ahead with. For the scientific programmer, there are the Numpy, Scipy, and Pylab modules (I installed the Python(x,y) package on my Windows laptop, which includes those and more besides.) Numpy extends Python with a fast array and matrix manipulation capability. Scipy includes a variety of analysis tools. Pylab looks to put a wrapper on those two, plus the Matplotlib graphics module and the Ipython interactive shell.
I recently wanted to extract spectral information about dolphin clicks from one of the datasets that I hadn’t previously examined. So I turned to Python to do that. The data was stored as raw binary, 16 bit signed integer samples. Reading that data was simply:
- fd = open(fn, 'rb')
- read_data = np.fromfile(file=fd, dtype=np.int16)
- fd.close()
where “fn” is a filename pulled from the directory of interest. The “np” reference above resolves to “numpy”. The three lines say to get an open file object, fd, by opening a file, fn, for binary read. Then, a Numpy array containing the data is returned by the Numpy static method, fromfile, given the file object and the specification of the data type as signed 16 bit integers. The third line closes the file object. If I had a problem with endian issues, there’s at least a couple of ways to address that in Numpy. (Getting the wrong byte order should be obvious on visualization, but I’ve seen a professor merrily tout a new processing method for dolphin clicks when his slides clearly showed that he had a byte-order problem with his dataset.)
While it is better to handle DC offset problems at the time of data collection, sometimes you just have to deal with it at analysis time. This dataset handed me that problem. This problem is one where a time-varying signal should be centered at zero volts input, but instead centers at some non-zero voltage. Fortunately, it was a fixed offset, so a pretty simple approach worked nicely: find the mean value across the dataset, and subtract that value from each sample.
- shiftdata = read_data + ([-np.average(read_data)])
The use of a Numpy array for the data means that the one line above handles the element-wise addition operation. The Numpy array on the left is now a floating-point array instead of an integer array.
My Delphi program had a click-picking algorithm that took a while to craft. I haven’t ported it yet, so I just went with a very simple approach in Python. That looks at chunks of the data, where the chunksize was selected to be a bit larger than the maximum click width, but a good deal smaller than the interval between clicks. Within each chunk, the maximum value and minimum value are found. If the maximum and minimum are outside a defined noise level, consider it a found feature.
- chunkmin = np.min(cary)
- chunkmax = np.max(cary)
- if (chunkmin < -noiseband) and (chunkmax > noiseband):
- # Found a click! Or a transient, at least.
- chunkmaxloc = cary.argmax()
Using the Numpy routines to find the min, max, and max location is pretty snappy.
Then, for each “click” located, I ran an FFT to get a power spectral density, and plotted that. I just used example code to add this functionality. (For underwater acoustics where pressure is measured, though, the conversion to decibels uses a factor of 20 rather than 10.)
So, for a quick and dirty script of less than three hundred lines total, I was able to:
* get a directory listing
* match to filename features to identify files to analyze
* remove DC offsets
* save new versions of the data
* scale the data according to field notes
* locate “clicks” in the data
* generate a PSD for each “click”
* collect PSD data
* generate and save oscillogram/PSD plots
* rank “clicks” on spectral features
* copy off plots of the highest-ranked clicks to a directory
My 2.4GHz dual-core Ubuntu workstation ran this script on 230 megabytes of data, producing over 1,400 graphs, and did it in eight minutes time. I’ve just located a calibration sheet on the hydrophone used, so once I’ve digitized that and applied it, I’ll post an example with real dB numbers on the axis.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 6391 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 1590 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Acoustics &Computation &Science Wesley R. Elsberry on 12 Feb 2012
The Weekend
I don’t know what other people got up to this weekend, but mine has been pretty well filled with computing projects.
I’ve been working with my friend Marc to try to get to the bottom of the Verizon FIOS connection foul-up. We each ran TCPDUMP on our respective machines while making a request that could be fulfilled (a small static HTML page) and one that could not be fulfilled (a dynamic page for webmail). We’ve sent the logs off to a networking guru friend of ours to see if he has any ideas. While I fully expect that this is a problem in Verizon’s gear and processes, we are continuing to test any possibility that a fault in our gear could be an issue.
As I’ve mentioned previously here, I have data stretching back to the mid-1990s on CD-ROM. I’ve made a chunk of progress toward refreshing the archive by copying various of those to hard disk. It takes time, and needs manual attention every five minutes or so to unmount the last disk, load the new disk, mount it, and set up a copy process. Fortunately, most of the disks simply copy without error. I’m using ddrescue to go after the few files that won’t copy cleanly.
I’ve also been going through some of the packed boxes to locate more disks to be refreshed. Along the way, I’ve been reminded that I also have a pile of video and acoustic recordings on tape to digitize as well. I do have a cassette tape deck set up to digitize to my laptop, but I haven’t gotten my desk set up nicely to incorporate the video digitizing machine into a smooth workflow. From left to right, I have a Macbook Pro, a Viewsonic 24″ LED monitor for a second screen for a laptop, a Gateway MT6458 laptop running Win7, an Optiquest 15″ monitor for a desktop machine, plus keyboard and mouse for a desktop. Under the desk itself, I’ve got the video digitizing machine and the workstation/file server box. The video digitizing machine was built as state-of-the-art in 2001. It runs Windows XP, since the digitizing card doesn’t work under anything more recent. It still does a nice job of pulling in analog sources in a DV video stream. The file server is much more recent, being built in 2007. It runs Ubuntu Linux 11.10. There’s 4 terabytes of hard disk storage in that machine, which we use for our project files, personal files, multimedia, photos, and data. We’re coming up to the limits on that, especially after this weekend’s work.
I found a box of pocket notebooks, several of which have notes from our research data collection. But I did find one that has notes from the 1997 Discovery Institute conference on “Naturalism, Theism, and the Scientific Enterprise”. I see from my notes that Michael Ruse classed approaches to “religion v. science” into “conflict”, “accommodation”, and “separation”. I don’t think “accommodation” was used by Ruse in exactly the same way that more recent commentary has gone, but I thought it interesting to see the word there, anyway.
I’m also working on some Python programming and a PHP/MySQL project. Between these things, that pretty well soaks up the time.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 11666 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 1972 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Education &Media &Science &Wildlife Wesley R. Elsberry on 09 Jan 2012
No One Expects the Comparative Anatomist
Upcoming television series on PBS: Inside Nature’s Giants, begins January 18th at 10 PM.
Professor Joy Reidenberg is an unlikely TV star. She’s a comparative anatomist with the Mount Sinai School of Medicine in New York. Physically, she is diminutive, dark-haired and dark-eyed, and not the sort of slender sylph in morphotype that TV producers seem to favor. But Joy has deep anatomical knowledge and a gift for communicating what she knows, and that led the producers of the documentary series, “Inside Nature’s Giants”, to feature Joy in their program.
Diane and I have known Joy for years as a fellow attendee of various biennial conferences hosted by the Society for Marine Mammalogy. At the latest conference, we caught up with her following the conference-end banquet. She spun us a fascinating tale of how she came to star in a television series. Joy said that she received a call from the producers early one Friday afternoon preceding a holiday weekend, asking her if she might be interested in dissecting a stranded fin whale for a television program. Sure, she said, thinking that they were prospecting and planning for a project that would be months, if not years, down the road. So the question following her “yes” response floored her: Could she be on the plane for Ireland at 6 PM? Maybe was the answer, as Joy told us that physically getting to each part of the transportation network she’d need to get her stuff and passport would stretch things. Her husband and daughter decided to join the expedition. To cut things short, Joy and family made it to Ireland, and despite various amusing misadventures, made it to the locality of the whale stranding on time. There, the documentary producers pressed her into service as liaison to the local health authorities, who had to be convinced that permitting a whale necropsy on the spot was the best way forward to safely disposing of the carcass. She also had to try to convince the police to keep people away from the body, and she reported less success on that front. In any event, Joy got to do the dissection there for the cameras, and her innate enthusiasm and ability to draw people into discussion of anatomy impressed the producers so much that she became a regular co-host on the series.
There was also the adventure of traveling back home. Diane and I have attended necropsies of cetaceans, sirenians, pinnipeds, and sea turtles, and one has to take fairly strong measures to deal with the remaining odor that clings to clothes, skin, and hair. Joy had to physically get inside a decaying whale there in Ireland, and that makes for a different scale of olfactory assault. Joy told us of taking a succession of showers with vigorous scrubbing, but in the end even her family opted to stay in a separate room at the hotel. On the plane ride back, Joy was shifted to the very rear of the plane by the flight attendants, who kindly told the other passengers that they were having trouble with the toilets to explain the stench.
The TV series, “Inside Nature’s Giants”, is slated to air six episodes on PBS, starting January 18th, 2012, at 10 PM. The series is all about charismatic megafauna, but concentrates on post-mortem anatomical examination. Check your local PBS affiliate to make sure of the schedule. Another regular on the series who should be familiar to readers is Prof. Richard Dawkins.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 41021 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 3952 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Science &Wildlife Wesley R. Elsberry on 27 Nov 2011
SMM 2011: Sirenian Workshop
I’m attending the Society for Marine Mammalogy biennial conference this year. The location is the Tampa Convention Center, making this pretty simple to get to.
Saturday and Sunday are when various workshops are held. Today, I’m attending the Sirenian workshop. It is an all-day affair, with 33 speakers and over 200 attendees.
My early connectivity was best with my Facebook account (Wesley R. Elsberry), but I’ve gotten set up with synced Twitter (welsberr) and Facebook status updates, so most of what I’m noting as things proceed will be going out that way.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 65969 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 4444 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Acoustics &Computation &Science &Wildlife Wesley R. Elsberry on 14 Aug 2011
Multiple Sound Sources in the Bottlenose Dolphin
It’s been a long time coming, but the paper on evidence for multiple sound sources in the bottlenose dolphin appears in the October 15th issue of the Journal of Experimental Marine Biology and Ecology. I’ve been told that the PDF will be freely available soon, hopefully in the next week or so.
The abstract is:
Indirect evidence for multiple sonar signal generators in odontocetes exists within the published literature. To explore the long-standing controversy over the site of sonar signal generation, direct evidence was collected from three trained bottlenose dolphins (Tursiops truncatus) by simultaneously observing nasal tissue motion, internal nasal cavity pressure, and external acoustic pressure. High-speed video endoscopy revealed tissue motion within both sets of phonic lips, while two hydrophones measured acoustic pressure during biosonar target recognition. Small catheters measured air-pressure changes at various locations within the nasal passages and in the basicranial spaces. Video and acoustic records demonstrate that acoustic pulses can be generated along the phonic fissure by vibrating the phonic labia within each set of phonic lips. The left and right phonic lips are capable of operating independently or simultaneously. Air pressure in both bony nasal passages rose and fell synchronously, even if the activity patterns of the two phonic lips were different. Whistle production and increasing sound pressure levels are generally accompanied by increasing intranarial air pressure. One acoustic “click” occurred coincident with one oscillatory cycle of the phonic labia. Changes in the click repetition rate and cycles of the phonic labia were simultaneous, indicating that these events are coupled. Structural similarity in the nasal apparatus across the Odontoceti suggests that all extant toothed whales generate sonar signals using the phonic lips and similar biomechanical processes.
This was a big undertaking, requiring the coordinated effort of a lot of talented and busy people.
Diane Blackwood designed and implemented our acoustic recording layout and the dolphin stationing device and biteplate, and made sure the amplifying equipment was operational and protected from incident. (Incidents with electronics in proximity to sea water are all too common.) I designed and wrote the software that acted as a multichannel digital data recorder, the data reduction program, and the analysis program. Bill van Bonn was our veterinarian who spent our data recording sessions lying prone on the dock as he placed, checked, and positioned the endoscopes and pressure catheters. Our principal investigator, Ted Cranford, operated the video side of things, including the high-speed video capturing the endoscope views. Sam Ridgway and Don Carder consulted with us, helping us with the use of the pressure catheters (which had previously been used in two prior studies they authored). Monica Chaplin and Jennifer Jeffress were the dolphin trainers on the spot during data recording. Tricia Kamolnick and Mark Todd were trainers who helped get the subjects prepared for our data collection process, and Mark Todd implemented the regular video system. It took between two and three hours each data collection day for us to set up, test, and calibrate all the equipment. Breaking down took somewhat less time, but I would still have to run a custom program to demux the data, produce images visualizing the data for each trial, and then shift the day’s data off the hard disk and on to CD-ROM media.
Update: The Marine Mammal Center has put up the PDF of the paper.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 117211 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 7912 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Acoustics &Science Wesley R. Elsberry on 14 Jun 2011
Cool Acoustics Product: Tern Micro GR4
I occasionally check out the Tern Micro website. They are manufacturers of controllers and expansion boards for embedded applications. Their controller boards use IAPx86 class CPUs and are programmed in C. A few years ago, I had checked with them about whether they had components suitable for a field acoustic recorder, and given the short time schedule we had, we decided to go with off-the-shelf components instead for that. Things have changed, though, as I found an expansion board of theirs called the GR4 on their page.
Let me set some context. Some years ago, Whitlow Au and Marc Lammers put together a four-element hydrophone array that allowed them to perform acoustic localization. If I recall correctly, their recording system was based upon a National Instruments DAQ card for CardBus hosted in a laptop computer and was capable of 500 kilosamples per second. When multiplexed across four channels, that’s a max of 125 kilosamples per second per channel. With a multiplexed system, you have to account for time offsets between channels as you analyze the data for time-of-arrival estimates of signals. If there is crosstalk at the high acquisition rates, you might have to drop the total sampling bandwidth to give the multiplexing circuitry time to settle to the next channel’s input level. That at least is how I had to work with an NI PCI-MIO-16-E DAQ card back in 1999. The solution to this problem is simultaneous-sampling, where all the channels of interest get their own sample-and-hold circuitry and the conversion is triggered off the same clock input. Simultaneous-sampling hardware is more expensive, since the main sets of circuits have to be multiplied for the number of channels. Around 2001, a project I was involved with bought a couple of simultaneous-sampling DAQ cards for the PCI interface, at a cost of a couple of thousand dollars each.
Of course, lugging a full-up desktop system into the marine environment is not a thing to be undertaken lightly. If one could instead reduce the field recording part to something that could be effectively shielded from the elements and work instead off of straight DC battery power, it would be all-around more convenient. The more remote the field work, the more convenient that gets.
So let’s get back to the Tern GR4. This analog-to-digital expansion board is small, just a bit longer and wider than a business card. It can be provisioned with two ADC chips and 4 MB of memory (and that full configuration is what I’m talking about). The base price is $129, but with the additional features added the cost is $259. The GR4 boards are stackable. There are pin headers that form a communication and data bus with a controller card. Each GR4 permits simultaneous-sampling of two input channels. Each GR4 with two ADC chips aboard can record to its own CompactFlash card continuously by switching between ADC chips and FIFO memory, allowing the just-converted data from one FIFO to be streamed to the CF card while the other is collecting newly-converted data. Because the GR4 units are stackable, you can run several together at once. The Tern page shows a stack of four GR4s and a controller card. The maximum sample rate for the GR4 is 500 kilosamples per second. This means that each simultaneously-sampled channel can be recorded at that 500 kilosamples per second rate. It does 16-bit conversion, which gives good dynamic range to the recordings.
So the technical problem of getting to a four-channel field-deployable data recorder capable of capturing most of the acoustic information from a dolphin click has gotten both easier and cheaper with Tern’s GR4. I had a chat with a technical representative at Tern going over what would be needed for this application, and basically got a recommendation for a couple of different controllers that could do the job with the addition of two GR4 units. Tern offers an evaluation package of a controller board plus the interface hardware and software needed for system development at $249. Add-on options are additional cost. For one of the boards, I’d be interested in an LCD 16×2 readout, RTC clock, CompactFlash interface, and switching regulator, which would add another $100 to the $249 evaluation kit price. So for $349 + 259 + 259 = $867, I’d have that part of the data recorder in hand. Of course, I’d still be looking at a variety of additional costs in development, but this makes contemplating the task that much more feasible.
There are some additional concepts that ought to be broached. For two GR4s, one has to provide CF cards for each. It is pushing the hardware to get continuous sampled data out to the CF card on each expansion card. Trying to move the data over the bus to the controller and out to its CF card just isn’t feasible. There is no file system involved on the CF cards; the data is written to absolute sectors. This makes it a bit more interesting pulling that data off for analysis. In development, it will be up to the programmer to track which sectors go with which recording if multiple recording sessions are used. The signal input range for the ADC circuitry is 0-5V, which means that the output of many amplifiers will have to be conditioned to fit in that range. When recording two channels at 500 kilosamples per second, the total data bandwidth is 2 million bytes per second. So each CF card will receive about 7 gigabytes of data per hour of recording operation. A 32 GB card should be good for over four hours of data recording before needing to be swapped out. The Tern rep estimated that my stack of a controller plus two GR4s would pull around 500 mA of power at 5V while recording. The A-86-P controller at least has on-board power regulation so that it handles DC input from 8.5V to 24V and delivers regulated 5V power to its stack. I figure something like a motorcycle 12V battery would likely provide enough juice for a day’s worth of recording. When not actively recording, though, the controller and its stack can go into a sleep mode that draws only a few mA, which saves a lot on battery power.
I was told by the Tern rep that the GR4 was developed for the needs of a research group doing field work on bat biosonar. It’s no wonder that it caught my eye when I ran across its description.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 80096 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 8314 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Acoustics &Science Wesley R. Elsberry on 20 May 2011
Plotting a Dolphin Biosonar Click Train
I’ve been busy recently doing up figures for a paper on dolphin biosonar. One of the figures we ended up turning in earlier this week wasn’t exactly as I wanted it, but deadlines don’t wait. I put a lot of hours into trying to find alternative plotting for it, but just hadn’t found the right approach for an alternative.
Now that we’re done with that paper’s submission, I think I’ve found the approach to use in the future.
Here’s the problem: show the power spectral density (PSD) curves for all the clicks in a biosonar click train. What I was using years ago was my own code plotting a waterfall of PSDs on a bitmap. But I tied things too closely to the specifics of how I generated the PSDs, so for the 256-point FFT window I end up with each PSD’s width as exactly 256 pixels. That’s less than an inch for standard 300 dpi print resolution.
There are examples for “fence” plots in gnuplot and Python’s matplotlib, but I wasn’t able to get stuff that looked much better than up-res’d versions of my originals. Did I mention that I want to assign particular colors to each PSD in the click train?
Yesterday, I was thinking a bit more about the problem, and decided to look into Python’s matplotlib again, this time going from the demo code on using a PolyCollection, that is, a collection of arbitrary polygons. That is looking quite promising. Here is an example of what I’ve got so far going along this approach:

The shapes are nicely done, I like being able to set a transparency value, I can output to a scale and file type I specify, and I can assign a specific color to each PSD in the series. (The colors are randomly set in this demo.) About the only quibble I have with the whole thing is that I’d like to run the “Y” axis in the other direction, so that the earliest clicks are plotted at the back of the plot, and the most recent are in the foreground. It’s easy enough to flip around the list, but I haven’t yet figured out getting the numbering to run the wrong way.
About the particulars of this click train… the X axis is in kiloHertz units (kHz). There are 24 clicks in the click train. It is apparent that the click train shows variation in the spectral content and amplitude of clicks, with a ramp-up to high-amplitude and high peak frequency, and followed by diminishing amplitude toward the end of the click train. For the highest-amplitude clicks, one may notice that there is some energy at the very highest frequency bins. There was anti-aliasing applied in the recording setup, but it evidently was not entirely adequate to the task. The B&K amplifier used has built-in attenuation of -3dB at 200 kHz, IIRC. The B&K hydrophone, an 8103, has roll-off at frequencies that high. So, if anything, the magnitude of energy in the highest frequency bins shown here is underestimated. That the high-frequency energy is correlated with the high peak frequency, high amplitude clicks is an indication that this isn’t a general issue with background noise; this is part and parcel of the dolphin biosonar click output. There’s some research that Diane did with the UT ARL group on such high frequency components in dolphin biosonar that I’d like to revisit sometime soon.
Update: A handy page over at StackOverflow put me on course to flip my Y-axis numbers. I’ve also fixed up assigning colors that way that I want them, so now the result is looking much better to me.

The colors correspond to a classification based on spectral features (all things related to the FFT taken) first proposed by Houser, Helweg, and Moore in the late 1990s. I don’t process my transform in exactly the same way that they processed theirs, so the resulting classification is not necessarily identical to what they would have found if they processed the same click train. An extended discussion on that should be put off to another post.
Update 2: That was all too optimistic. There is a bug in “matplotlib”. Actually, if you look closely at the figure just above, the red polygon toward the back is plotted over a blue polygon, and it should not be. Depending on the view angle chosen, “matplotlib” gets the render order of polygons wrong. I was able to reproduce this error directly in the example code provided on the “matplotlib” website. Here’s the problem demonstrated:

I’m posting it here especially so that the “matplotlib” people can have a look. For my data and just 24 polygons, I can find angles where about a third of the polygons are rendered out of order. For other angles, everything renders properly. If you happen to like one of the correct-rendering angles, you can use the output. If the angle you want happens to be in the other range of incorrect-rendering, context does not seem to matter; no matter which direction you come to that view, it still renders incorrectly.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 75832 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 8294 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>Science Wesley R. Elsberry on 11 May 2011
Revisiting Code
Back in graduate school, I wrote tens of thousands of lines of Delphi code in support of research projects I worked on. Well, it is several years later, and my colleagues and I are getting back to the job of writing things up from those projects. And with manuscripts, one also has figures. A fairly urgent task for my spare time currently is working up requested revisions of figures that were originally produced almost a decade ago. I’ve pulled a couple of things into Python and used Matplotlib for figures, but many things I did with heavy tweaking of the Delphi TChart component, and the simplest path to revised figures for those still lies within Delphi.
While it isn’t exactly simple, the thing is that I can figure out where I was getting various things done. There is something to be said for Delphi’s Object Pascal language, where even with some years intervening and a distinct dearth of comments (yeah, mea culpa), I’m getting the gist of things in fairly short order. For one scatterplot, the original had a color progression that went with the time of each click being plotted, so each click was represented by a dot of a hue indicating its position in time in the click train. Well, that wasn’t wanted for print, so the request is for the same plot, but using a grayscale. The color progression doesn’t simply translate, so it was back to the code to re-do the thing in grayscale. I just finished that one up this evening. The Delphi 5 IDE holds up as a usable development tool, but I’ve gotten used to later-generation tools like Apple’s Xcode and Microsoft’ Visual Studio 2010, and it does look dated compared to those.
I do want to eventually have a library of Python classes that will work with the dataset, and I’ve made some progress on that score. I’ve used the ‘struct’ module to parse various files composed of binary Delphi records and used SQLite to stuff the contents into a database. I have a partially-completed Python signal processing script to tackle going through all the original signal data I have and apply various techniques that I simply didn’t have the compute-power before to try. Again, the sticking point is more that the time I can apply to any of these things is limited, given that so much remains to fix up in our fixer-upper of a domicile.
<= get_option(\'vc_tag\') ?>> = get_option(\'vc_text_before\') ?> 64143 = get_option(\'vc_human_count_text_many\') ?> = get_option(\'vc_preposition\') ?> 7486 = get_option(\'vc_human_viewers_text_many\') ?> = get_option(\'vc_tag\') ?>>




CafePress Shop