Hardware Reference
In-Depth Information
Standard Streams
Linux supports standard streams, a mechanism to allow the output of one program to be
fed into another one. This allows very powerful combinations of programs to be connected
together on the command line to process data. There are three standard streams:
Standard in ( stdin ) - Used for input.
Standard out ( stdout ) - Used for output.
Standard error ( stderr ) - Another sort of output, reserved for reporting error
messages.
Essentially standard streams can be thought of as special iles. One program will write to its
stdout stream, which can be piped (think of the commands as stages in a pipeline) to the
stdin stream of another. This program reads from its stdin to receive the data. If no
other program is speciied, by default stdin will be taken from the keyboard, and stdout
will be displayed on the screen in the terminal.
The | character is used to indicate that the output of one program should be piped into
another. For an example of how pipes work, imagine that you want to sort the list of the
iles in your home directory in reverse order. The command ls lists the contents of a direc-
tory to stdout . The sort command takes input from stdin , orders it and sends it to
stdout . The -r argument tells sort to reverse the ordering. So, to reverse sort a list of
contents of a directory, in a terminal type
ls | sort -r
****sort uniq wget cat grep >
To test the analysis program, use the cat program to pipe the contents of your birddata.
txt ile into your Python program by typing the following in a terminal:
cat birddata.txt | python analyseBirdDataBasic.py
With DEBUG=1 set, the program will go through the state machine, process the sensor log
entries and print a description of what it thinks the bird is doing.
Dealing with Sensor Noise
In everyday life, someone may say that an environment is too noisy for him or her to hear
properly. Noise is the sound that is unwanted and getting in the way of what the listener
 
Search WWH ::




Custom Search