Racing last night at Bashley the car was still quite unstable. For the last few races I have been changing one setting at a time to pin down which are making improvements.
So far I've stiffened the front springs, moved the shock positions on the rear and toed out the steering a little. The car was better but still quite hard to tame the back end..
If you look closely at the tyres you can just about make out that the insides of the tyres are a little duller meaning that the majority of the cars weight has been on the insides even during dynamic handling. This is a big clue to start looking at the camber adjustments.
Camber is the angle of the wheel relative to the track looking from the front of the car. 0 degrees means the wheel is dead vertical. -5 degrees means the top of the wheel is angled toward the centreline of the car. A little negative camber can be useful, but evidently I had too much. I rather unscientifically reduced the amount and in the next heat the car was far more controllable with more power going to the track.
Thursday, January 31, 2013
Wednesday, June 22, 2011
NADARS Newbury Radio Rally
Each year on Fathers day the Newbury and District Amateur Radio Society organise their rally which has been at the Newbury Showground for the last few years.
For anyone not familiar, radio rallies or hamfests as they are sometimes known are a show organised by an amateur radio society. They usually take the form of a field with trade stands, a club stand and a car boot section. There is often a very varied mix of things on sale from old wartime radios, military surplus, old broadcast equipment, telecom equipment, components to computers and all manner of bits and pieces.
This has always been one of the nicest rallies and one which has been on my list of favourites since about 1993, so I thought I'd share a few photos of the day.
We got there a little late, but it was still a good day. I picked up a few bits for the DATV station I'm planning on building, an NDS CSR820 MPEG2 IRD and some L-Band filters and splitters. I also met an old friend which was nice.
It was a bit of a drive (4 hours) but still happy I went.
NADARS - http://www.nadars.org.uk/
Wednesday, March 16, 2011
Maker Faire Newcastle 2011
Maker Faire Newcastle, UK 2011
Last week Makers and Hackers from all over the world converged on the Centre for Life in Newcastle-Upon-Tyne for the UK's third Maker Faire. Maker Faire is an event organised by O'Reilly's Make magazine to bring together art, crafts, technology, engineering and science projects and to celebrate and encourage the Do it Yourself mindset.
The BBC's Research and Development and Television Platforms groups were there meeting the public and making friends with other Makers. We had several exhibits ranging from the fun Blink-o-tron with its trapped Weeping Angel, Conduct your own orchestra to the more serious Universal Control which allows subtitles to be sent to mobile devices.
The Maestro demonstrates in an entertaining way our ability to interface to the Microsoft Kinect and to use thedata provided to control video playback. Basically you use the baton and move your hands in the manner of an orchestral conductor and you can control the volume and tempo of the music.
We also showed a concept device which presented a different way of accessing the BBC's Radio archive. The 'Wayback Machine' is designed to look as much like a traditional radio as possible, retaining simple controls, but allows the date and time to be 'tuned' in.
An example of the BBC's collaboration with Newcastle University was also on show with the Tune Table, a device which was developed by one of the universities students while on placement with R&D.
The Tune Table was built to explore the control metaphore and investigate its applications for areas such as video editing.
We also tried to entertain (and sometimes scare) some of the visiting children with our Blink-o-tron and its trapped Weeping Angel from Doctor Who. This is an example of some basic microcontroller hacking using an Arduino, some LED's and some pieces of plexiglass which works on he principle of Pepper's Ghost. Don't Blink!

There was also a homebrew tapeless camera system on display which lead us nicely into conversations about how the BBC are moving towards using systems such as INGEX and the Digital Media Initiative (DMI).
We also met with and talked to a great many members of the public about the work we do and we dealt with many enquiries about our employment opportunities at BBC North in Salford.
What the other bloggers are saying:-
http://www.youtube.com/watch?v=Bked4XQz89g
http://vickyteinaki.com/blog/maker-faire-uk
http://zine.openrightsgroup.org/reviews/2011/maker-faire-2011
http://zuzebox.wordpress.com/2011/03/15/maker-faire-uk-2011/
http://www.youtube.com/watch?v=yhNohhCnX2I&feature=related
Credits:
Video: Brendan Crowther, Laura Chalmers, Ian Calvert, Bruce James
Photos: Bruce James
Blog: Bruce James, Yameen Rasul
Organisation: Max Leonard, Yameen Rasul
On the stand: Max Leonard, James Barrett, Tom Bartindale, Bruce James Andrew Bowden, Ian Calvert, Mo McRoberts
Last week Makers and Hackers from all over the world converged on the Centre for Life in Newcastle-Upon-Tyne for the UK's third Maker Faire. Maker Faire is an event organised by O'Reilly's Make magazine to bring together art, crafts, technology, engineering and science projects and to celebrate and encourage the Do it Yourself mindset.The BBC's Research and Development and Television Platforms groups were there meeting the public and making friends with other Makers. We had several exhibits ranging from the fun Blink-o-tron with its trapped Weeping Angel, Conduct your own orchestra to the more serious Universal Control which allows subtitles to be sent to mobile devices.
The Maestro demonstrates in an entertaining way our ability to interface to the Microsoft Kinect and to use thedata provided to control video playback. Basically you use the baton and move your hands in the manner of an orchestral conductor and you can control the volume and tempo of the music.
We also showed a concept device which presented a different way of accessing the BBC's Radio archive. The 'Wayback Machine' is designed to look as much like a traditional radio as possible, retaining simple controls, but allows the date and time to be 'tuned' in.
An example of the BBC's collaboration with Newcastle University was also on show with the Tune Table, a device which was developed by one of the universities students while on placement with R&D.The Tune Table was built to explore the control metaphore and investigate its applications for areas such as video editing.
We also tried to entertain (and sometimes scare) some of the visiting children with our Blink-o-tron and its trapped Weeping Angel from Doctor Who. This is an example of some basic microcontroller hacking using an Arduino, some LED's and some pieces of plexiglass which works on he principle of Pepper's Ghost. Don't Blink!

There was also a homebrew tapeless camera system on display which lead us nicely into conversations about how the BBC are moving towards using systems such as INGEX and the Digital Media Initiative (DMI).
We also met with and talked to a great many members of the public about the work we do and we dealt with many enquiries about our employment opportunities at BBC North in Salford.
What the other bloggers are saying:-
http://www.youtube.com/watch?v=Bked4XQz89g
http://vickyteinaki.com/blog/maker-faire-uk
http://zine.openrightsgroup.org/reviews/2011/maker-faire-2011
http://zuzebox.wordpress.com/2011/03/15/maker-faire-uk-2011/
http://www.youtube.com/watch?v=yhNohhCnX2I&feature=related
Credits:
Video: Brendan Crowther, Laura Chalmers, Ian Calvert, Bruce James
Photos: Bruce James
Blog: Bruce James, Yameen Rasul
Organisation: Max Leonard, Yameen Rasul
On the stand: Max Leonard, James Barrett, Tom Bartindale, Bruce James Andrew Bowden, Ian Calvert, Mo McRoberts
Wednesday, March 9, 2011
Wayback Machine visits Maker Faire
Getting the Wayback Machine ready for Maker Faire.
Since the last update the radio has gone through some drastic hardware changes. There is still an Arduino driving the LCD and user interface but the backend has been replaced by a Beagleboard running Angstrom Linux. This has enabled the radio to stream and play MP3 files and also allows the use of Wifi or 3G data dongle.
BBC R&D North visited Maker Faire in Newcastle on the 12th and 13th of March 2011.
http://www.bbc.co.uk/blogs/researchanddevelopment/2011/03/bbc-rd-at-the-big-bang-science.shtml
http://makerfaireuk.com/
Since the last update the radio has gone through some drastic hardware changes. There is still an Arduino driving the LCD and user interface but the backend has been replaced by a Beagleboard running Angstrom Linux. This has enabled the radio to stream and play MP3 files and also allows the use of Wifi or 3G data dongle.
BBC R&D North visited Maker Faire in Newcastle on the 12th and 13th of March 2011.
http://www.bbc.co.uk/blogs/researchanddevelopment/2011/03/bbc-rd-at-the-big-bang-science.shtml
http://makerfaireuk.com/
Labels:
Beagleboard,
electronics,
embedded,
makerfaire,
mfuk,
radio,
wayback
Tuesday, February 8, 2011
Git crib sheet
Been using Git lately.
Much goodness to be had, but some commands are a little unfamiliar if coming from Subversion.
So, here's my crib sheet of handy Git recipes I think will be useful.
Configure your Git
bash-3.2$ git config --global user.name "CustardCat"
bash-3.2$ git config --global user.email "custard@cpan.org"
bash-3.2$ git config --global -l
user.name=CustardCat
user.email=custard@cpan.org
# Create a project and cd into it..
cd my_project
# Make the project a git project
git init
# Add all the files in the project to git
git add .
# Commit your local files
git commit
git status
# Diffs
git diffs
# Add more files
git add file1 file2 etc..
# See what's been happening
git log
git log --stat --summary
git log --pretty=oneline
# See diffs between versions. nb. only need first few chars of version
git diff 16f8..8bd2
git diff HEAD^..HEAD
git reset --hard
# Edit the commit message
git commit --amend
# Add forgotten files to the last commit
git reset --soft HEAD^
git add forgotten.file.txt
git commit
#Ignore files - also can use wildcards
vi .gitignore
git add .gitignore
git commit
git branch splendid_branch
# View Branches - asterisk shows the current branch
git branch
# Switch to the new branch
git checkout splendid_branch
# Switch back to master
git checkout master
# Merge the branch into master
git merge splendid_branch
# Tagging - use tag names in place of the revision ids
git tag v1.2.3
git clone git://git.kernel.org/.../blah my_blah
cd my_blah
# Pull changes from origin (update from upstream)
git pull origin
# Check logs since pull
git log -p ORIG_HEAD../some/dir
# Extract patches
git format-patch HEAD^
git format-patch origin
# Pull from branch and merge
git pull git://git.kernel.org/.../some_ branch.git ALL
# Revert a pull
git reset --hard ORIG_HEAD
# Garbage collect
git gc
# Update tags from original
git fetch --tags
Much goodness to be had, but some commands are a little unfamiliar if coming from Subversion.
So, here's my crib sheet of handy Git recipes I think will be useful.
Configure your Git
bash-3.2$ git config --global user.name "CustardCat"
bash-3.2$ git config --global user.email "custard@cpan.org"
bash-3.2$ git config --global -l
user.name=CustardCat
user.email=custard@cpan.org
Create a new project and commit your code...
# Create a project and cd into it..
cd my_project
# Make the project a git project
git init
# Add all the files in the project to git
git add .
# Commit your local files
git commit
Get status, logs & diffs
# Status of changesgit status
# Diffs
git diffs
# Add more files
git add file1 file2 etc..
# See what's been happening
git log
git log --stat --summary
git log --pretty=oneline
# See diffs between versions. nb. only need first few chars of version
git diff 16f8..8bd2
git diff HEAD^..HEAD
Reverting & adding files
# Throw all uncommitted changes away (revert)git reset --hard
# Edit the commit message
git commit --amend
# Add forgotten files to the last commit
git reset --soft HEAD^
git add forgotten.file.txt
git commit
Ignoring files
#Ignore files - also can use wildcards
vi .gitignore
git add .gitignore
git commit
Branches & Tags
# Making a branchgit branch splendid_branch
# View Branches - asterisk shows the current branch
git branch
# Switch to the new branch
git checkout splendid_branch
# Switch back to master
git checkout master
# Merge the branch into master
git merge splendid_branch
# Tagging - use tag names in place of the revision ids
git tag v1.2.3
Cloning & updating clone
# Clone a repositorygit clone git://git.kernel.org/.../blah my_blah
cd my_blah
# Pull changes from origin (update from upstream)
git pull origin
# Check logs since pull
git log -p ORIG_HEAD../some/dir
# Extract patches
git format-patch HEAD^
git format-patch origin
# Pull from branch and merge
git pull git://git.kernel.org/.../some_
# Revert a pull
git reset --hard ORIG_HEAD
# Garbage collect
git gc
# Update tags from original
git fetch --tags
Monday, December 6, 2010
Xilinx Coolrunner II & Xubuntu
After a few days wait the Xilinx Coolrunner II kit arrived in the post.
The Coolrunner is a CPLD which contains Macrocells, which are a step up from the basic gate array of a PLD and the XC2C256 on this board has 256 macrocells configured via an interconnect matrix.
Xilinx provide a programming suite, ISE, which is available for Windows and Linux. However they don't directly support Ubuntu.
Here is a brief howto to get the ISE running on Xubuntu.
The main hurdle with the ISE is that it requires a USB driver, windrvr6, in order to use the Platform cable (DLC9G). However it is possible to configure Xubuntu to use libusb and to get the programming tool, iMPACT, to use this instead.
1.Install prerequisites..
apt-get fxload
apt-get libusb
2. Configure the udev rules
These load the correct hex file when the device is attached.
jamesb@Jalapeno:~$ cat /etc/udev/rules.d/xusbdfwu.rules
# version 0003
SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0008", MODE="666"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode"
3. Install the hex files.
These can be found in the ${XILINX}/ISE/bin/lin directory.
jamesb@Jalapeno:~$ ls -al /usr/share/*.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusbdfwu.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusbdfwu.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_emb.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_emb.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xlp.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xlp.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xp2.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xp2.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xpr.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xpr.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xse.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xse.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xup.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xup.hex
You can use ln -s to create the symlinks..
4. Setup some scripts to start up ISE and IMPACT
jamesb@Jalapeno:~/bin$ cat ise
#!/bin/bash
source /opt/Xilinx/12.3/ISE_DS/settings32.sh
export XIL_IMPACT_USE_LIBUSB=1
XIL_IMPACT_USE_LIBUSB=1 /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/ise &
#!/bin/bash
source /opt/Xilinx/12.3/ISE_DS/settings32.sh
export XIL_IMPACT_USE_LIBUSB=1
XIL_IMPACT_USE_LIBUSB=1 /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/impact &
So, assuming that worked, plug in the platform cable and you should get an orange light.. you're good to go!
I suppose I'd better go off and write some code now.. byee..
My environment :-
Xubuntu 10.10
Linux Jalapeno 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 10:18:49 UTC 2010 i686 GNU/Linux
Xilinx_ISE_DS_Lin_12.3_M.70d.1.0 in /opt/Xilinx/12.3/ISE_DS/
Platform Cable DLC9G
Linky :-
http://www.xilinx.com/support/download/index.htm
http://www.xilinx.com/support/documentation/coolrunner-ii.htm
YMMV etc.
The Coolrunner is a CPLD which contains Macrocells, which are a step up from the basic gate array of a PLD and the XC2C256 on this board has 256 macrocells configured via an interconnect matrix.
Xilinx provide a programming suite, ISE, which is available for Windows and Linux. However they don't directly support Ubuntu.
Here is a brief howto to get the ISE running on Xubuntu.
The main hurdle with the ISE is that it requires a USB driver, windrvr6, in order to use the Platform cable (DLC9G). However it is possible to configure Xubuntu to use libusb and to get the programming tool, iMPACT, to use this instead.
1.Install prerequisites..
apt-get fxload
apt-get libusb
2. Configure the udev rules
These load the correct hex file when the device is attached.
jamesb@Jalapeno:~$ cat /etc/udev/rules.d/xusbdfwu.rules
# version 0003
SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0008", MODE="666"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode"
These can be found in the ${XILINX}/ISE/bin/lin directory.
jamesb@Jalapeno:~$ ls -al /usr/share/*.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusbdfwu.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusbdfwu.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_emb.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_emb.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xlp.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xlp.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xp2.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xp2.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xpr.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xpr.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xse.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xse.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xup.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xup.hex
You can use ln -s to create the symlinks..
4. Setup some scripts to start up ISE and IMPACT
jamesb@Jalapeno:~/bin$ cat ise#!/bin/bash
source /opt/Xilinx/12.3/ISE_DS/settings32.sh
export XIL_IMPACT_USE_LIBUSB=1
XIL_IMPACT_USE_LIBUSB=1 /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/ise &
#!/bin/bash
source /opt/Xilinx/12.3/ISE_DS/settings32.sh
export XIL_IMPACT_USE_LIBUSB=1
XIL_IMPACT_USE_LIBUSB=1 /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/impact &
So, assuming that worked, plug in the platform cable and you should get an orange light.. you're good to go!
I suppose I'd better go off and write some code now.. byee..
My environment :-
Xubuntu 10.10
Linux Jalapeno 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 10:18:49 UTC 2010 i686 GNU/Linux
Xilinx_ISE_DS_Lin_12.3_M.70d.1.0 in /opt/Xilinx/12.3/ISE_DS/
Platform Cable DLC9G
Linky :-
http://www.xilinx.com/support/download/index.htm
http://www.xilinx.com/support/documentation/coolrunner-ii.htm
YMMV etc.
Wednesday, December 1, 2010
Audio board for the Camera A2D project
Started working on the audio board prototype for the Camera A2D project.
It's based around a pair of NE5532 op amps. The input stage converts the balanced line input from the microphone, and the second stage acts as a preamp with level control to supply the correct levels to the nNovia.
Should be on to some audio tests shortly so time to dig the signal generator and scope out.
Tuesday, November 30, 2010
Discrete Fourier Transform in Ruby
...Just for a laugh...
I'm reading this amazing book at the moment, http://www.dspguide.com/ and thought it would be fun to code some stuff in Ruby.
The code...
#!/usr/bin/ruby
require 'complex'
class DFT
def initialize( size )
@freq = Array.new( size, Complex(0,0) )
end
# set data
def data( data )
@data = data
end
# get frequency table
def freq
@freq
end
# reset the frequency table
def reset
@freq.map! do |d|
Complex( 0,0 )
end
end
# transform data and return the frequency table
def transform
raise "No input data" unless @data
(0..@freq.size-1).each do |k|
@data.each_with_index do |d,i|
@freq[k] = Complex(
@freq[k].real + d * Math.cos( 2 * Math::PI * k * i / @data.size ),
@freq[k].imag - d * Math.sin( 2 * Math::PI * k * i / @data.size )
)
end
end
return @freq
end
end
And a test...
#!/usr/bin/ruby
require 'dft.rb'
require 'test/unit'
class TestDFT < Test::Unit::TestCase
def setup
# Compose a data set containing two frequencies, f1 & f2
# Assume the data set contains 1 second worth of samples so
# f1 & f2 are in Hz and should be less than half the number of samples (Nyquist)
@data = Array.new(64)
f1 =10
f2 =25
amplitude = 1
i=-1
@data.map! do |d|
i=i+1
Math.sin( 2 * Math::PI * f1 * i / @data.size ) + Math.sin( 2 * Math::PI * f2 * i / @data.size )
end
end
def test_dft_throws_exception_with_no_input
dft = DFT.new( 32 )
assert_raise RuntimeError do
freq = dft.transform
end
end
def test_dft_has_correct_output_size
dft = DFT.new( 32 )
dft.data( @data )
freq = dft.transform
assert_equal( 32, freq.size )
assert_equal( 32, dft.freq.size )
end
def test_dft_has_correct_output
dft = DFT.new( 32 )
dft.data( @data )
dft.transform
assert dft.freq.at(10).abs > 1
assert dft.freq.at(25).abs > 1
end
def test_display
dft = DFT.new( 32 )
dft.data( @data )
dft.transform
puts "\nFrequencies found:\n"
dft.freq.each_with_index do |f,i|
if (f.abs > 1)
printf( "%d %.30f %.30f %.30f\n", i, f.real, f.imag, f.abs )
end
end
end
end
Wednesday, November 17, 2010
Unit testing in TCL
The unit...
#!/opt/local/bin/tclsh
proc fib {n} {
if {$n==1} {return $n}
if {$n==2} {return [expr {$n-1}]}
if {$n==3} {return [expr {$n-1}]}
return [expr { [fib [expr {$n - 1}]] + [fib [expr {$n - 2}]] } ]
}
The test...
#!/opt/local/bin/tclsh
package require tcltest 2.0
namespace import ::tcltest::*
source ../src/fib.tcl
# 1 1 2 3 5 8 13 21 34
test fib-1 { Test first is 1 } {
fib 1
} 1
test fib-2 { Test second is 1 } {
fib 2
} 1
test fib-3 { Test third is 2 } {
fib 3
} 2
test fib-4 { Test fourth is 3 } {
fib 4
} 3
test fib-5 { Test fifth is 5 } {
fib 5
} 5
test fib-6 { Test ninth is 34 } {
fib 9
} 34
test fib-7 { Test fortieth is 102334155 } {
fib 40
} 102334155
I put in the last couple of tests for good luck and for #ian :-)
Oh I must have been bored....
/
Tuesday, November 16, 2010
The Six Characteristics of Shorinji Kempo
Todays T-Shirt choice reminded me of the Six Characteristics of Shorinji Kempo.
- Ken Zen Ichinyo – Body and the mind are one.
- Riki Ai Funi – Strength and power should never be separated from compassion.
- Shushu Koju – Defence comes before attack.
- Fusastu Katsujin – Defend and protect without killing.
- Goju Ittai – Use hard and soft techniques together, in balance.
- Kumite Shutai – Pair work is fundamental.
That is all.
Subscribe to:
Posts (Atom)













