WHAT IS SPECTRUM
VIEWER?
Spectrum Viewer (SV)
is a utility that can help you manage two-dimensional spectra from, for
example, measuring apparatus (its functionality is similar to the XMGR program
which is used a lot in the UNIX world). This kind of equipment usually puts out
text files or binary files with one or two columns of data. Spectrum viewer is designed to make
the loading and displaying of a set of these spectrum files (up to 4000 in one
go) as easy as possible. Furthermore some file manipulation (like selecting a
displayed data set, and then physically deleting the corresponding file from
disk), data manipulation (like smoothing, trimming, spike elimination) and very
simple analysis (like calculating the area of a peak) is implemented. For
complicated analysis there are programs like Excel or Origin or Matlab (just to
name a few), SV concentrates on quickly displaying what you have just measured.
What's new?
- Version
2.1:
- ctrl-click hides a plot instantly
- ctrl-shift-click selects a plot and all the plots originating from the
same data file
- "Open special format" now supports external plug-ins for very
complex measure files.
- Pan functionality restored (was deleted in version 2.0): shift-drag drags
the whole graph around.
- Version
2.0
-
Up to 100 levels
of undo and redo (default 5)
-
The XY value displays (on the top right of the graph)
are now continuously updated when the mouse is moved, no need to click on
the graph to get a value
-
Drag plot. You can pick up a plot by the mouse and drag
it to any place you want. A bit easier than manually giving the numeric
values with the shift X and shift Y command.
-
Copy to clipboard. In order to export the data sets to
Excel or similar programs, you had to choose View->Table and then ctrl-a,
ctrl-c. With "copy to clipboard" you can skip this step.
-
Easier drawing of the zoom rectangle. When you want to
draw a rectangle to the edge of the graph, you can go over the edge
with the mouse, you don't have to position the mouse exactly on the
edge anymore.
-
Improved rectangle draw speed when many plots are
loaded (60+)
-
Many functions now support selecting just a part of a
plot by drawing a rectangle before invoking a specific function, like:
-
"Delete data points" deletes (discards or
interpolates by choice) all the data points within a drawn rectangle. Handy
for deleting single spikes from a plot. For data sets with a lot of spikes
it is better to choose the "delete large spikes" command in the
"smooth" menu.
-
Highly improved "delete offset jumps"
-
"Draw new data set" works now with dragging,
instead of just clicking. Ctrl-Z deletes the last data point(s) you drew,
one at a time.
-
Resample, define a given number of data points and the
program spreads them out over your plot. Might be handy when your data
points are not x-equidistant.
-
View Trend now can be done manually, with the up and
down arrows you can "thumb through" the data sets
-
Improved legend, a right-click on a legend name changes
it without changing the name in the name window as well
-
Drag and drop of measure files into Spectrum Viewer
-
Name panel can be docked/attached to the right hand
side of the graph panel
-
The font of the name panel can now be changed
-
The "open special format" settings now
include axis names and graph title.
-
The maximum number of data sets that can be loaded is now settable, up to
4000, in case any poor guy needs it :-). Set it low for maximum speed, set it high when you need it. The default is
50.
-
Some bugs hunted down, squished and eaten... hakuna
matata!!
- Version
1.8
-
Hidden plots
-
Ctrl-a
extension: only select the plots within a rectangle
-
Select only the
plots within a "zooming rectangle"
-
Histogram of Y
values
-
Perform shift Y
and multiply Y only on a selected part of a plot
-
Save session
-
SVF file format
-
DDE program
control
-
Bug fixes
-
Several slight
changes to make the program more user friendly
- Version 1.8.1
-
By special
request: Normalize Y (in
the "Position" menu). You can email me with a special
request as well and I'll see if I can implement it.
-
The folder
history in the "file open" panel is now saved when the program is
closed. It used to contain only the folders opened during a particular
session, now it contains all folders opened in the past, up to 15
folders
-
A minor bug fix
that would ask the user a confirmation twice when he wanted to overwrite a
file
- Version 1.8.2
INSTALLING THE PROGRAM
You can install the
program by running setup.exe. You can uninstall the program by either running
setup.exe for the second time, or by using the “Add/Remove Programs” option in
the Windows Control Panel. The program will install itself by default in the
C:\Program Files\SpectrumViewer folder.
In the program
subfolder called "TestSpectra" it will install a few files that you
can use to test and experiment with the program. The files all have a
"txt" extension so you can examine them with notepad. By doing this
you can also get an idea of what files the program is able to read. There are 28
TwoColumnExample files, that you can use for experimenting with opening a whole
bunch of files at the same time. Furtheron there is a "one column
example" file, a "time format example" file, and a file with 8
columns. Look at these files with notepad and you will see instructions on how
to open them in the program.
BASIC OPERATIONS
- Opening a file:
This is done with
ctrl-O as a shortcut, or by clicking “File -> Open data set(s)”. A dialog
box opens where you can select the files you want to open.

In the upper window
you can select the files, and by clicking “Add” they appear in the lower
window. The files in the lower window are the ones that will actually be
opened. This way, you can even select files across multiple folders and put
them in the lower window before opening them. After clicking “OK” all the files
will be opened and displayed. In the application subfolder “TestSpectra” you
can find a few spectrum files that you can use to test the program.
NOTE ON FILE FORMAT:
The program assumes by default that the measure file is a text file which
consists of one or
two columns of data (if your file has more columns, you have to use “Open
special format”). After opening, it determines by itself the number of columns
that the file has. With one column it numbers the X of every consecutive data
point from zero to the number of data points in the file, while storing the
data value in the Y axis. With two columns, the left column becomes the X axis,
and the right column becomes the Y axis. If you would like it the other way
around: swapping axes after loading is very easy, just select all sets by
pressing ctrl-A and do “Edit -> Swap X and Y axis”. Or, you can set the X
and Y columns manually with the “Open special format” command.
- Zooming in and out
By default, the graph
is set to “auto scaling” which means that the display is just as large as it
needs to be to display the complete data set. Keep in mind that the Y-axis
doesn’t start with 0 this way; it starts with the lowest data point! Zooming in
(or out) to the desired view can be done in several ways.
-
Click and drag
the mouse over the image. This will create a “rectangle to zoom to”. After doing this, a right mouse click will zoom in to
the rectangle. Another right click (or pressing F5, “redraw”) will zoom back to the full view
of the graph.
-
Set the viewing range
manually by “View -> X/Y Axis -> Viewing range”.
- Panning
Panning
is done by dragging the mouse over the graph while pressing "Shift".
- Selecting a
displayed data set
You can select a data
set by double clicking on its plot, or clicking on the corresponding plot name
in the name window. Double clicking on a name will select that
data set and deselect all others. Selecting a name, pressing shift and
selecting another, will select all the names in between the two. Ctrl-a selects
all plots. Ctrl-a in combination with a zooming rectangle (see "Zooming in
and out" above) will select all plots with data points within
that rectangle. Holding down ctrl-shift while clicking on a data set name, will
select all data sets originating from the same data file (if that data file
contains multiple data sets).
- Selecting just a
part of a
displayed data set
Many functions support
operation on just a part of a plot. You can select part of a plot by first
selecting it completely, and then drawing a rectangle around the part of the
plot you want to mutilate.
- Hiding a
displayed data set
You can hide a data
set instantly by holding down the ctrl-key and clicking on its name in the name
panel. To hide multiple data sets at once, select them and press ctrl-h (or View->Hide selected data set). A
hidden set will not appear on the graph,
but its name will still be present in the name window in a thin font. You can
unhide the data set by clicking on its name. Ctrl-u unhides all data sets.
- Determining a
point on the graph
When you move the mouse
over the graph, the corresponding X value and Y value of the mouse cursor
position are displayed on the
numeric displays in the upper right corner of the graph. The decimal precision
of these numeric displays is one higher than the decimal precision of the X axis
and the Y axis indicators. This precision is determined by the program dependent
on the content of the data sets. If you are not satisfied with the presented
precision, you can set it yourself with the menu: “View -> X/Y axis
-> Decimal precision”.
- Adjusting the
color of a data set, or assigning the Y value to another Y axis
Right-clicking on the
name of a specific data set will bring up the “Data Set Style” window.

Here you
can adjust the color, the name, the line style, the point style and the active Y axis.
Not all options are mutual compatible. For example, setting the point style
only has an effect if the points are actually visible: when the plot style is
set to “connected points” or “scatter”. The program will store the new settings
in the SpecView.ini file and remember them when the program is restarted. When
you make a mistake (for example, you’ve accidentally made all the plots the
same color), just close the Data Set Style window and select Undo. All changes
made when the style window was opened will be undone.
MENU DISCUSSION:
FILE MENU

- Draw new data set
-
By clicking
on the graph: Creates one new empty
data set. Every point you click on the graph is added to the data set, until
you right-click the mouse. You can also drag the mouse, and the program will
draw new data points as you go. Ctrl-z will remove the last drawn data
point(s), one at a time. Drawing data sets yourself can be useful for subtracting a background from
an existing plot. With this you can draw the background into a new plot, and then subtract it from the original plot using “Analyze ->
Subtract plot”
-
By entering
numeric values: If you need to multiply your data set with a sliding
scale to compensate for measurement sensitivity (for example
0.5 at the start and 2 at the end), you can do so by drawing a new graph
with these two values and then multiply your original plot with
it. However,
drawing such values by hand would be a tedious task. Hence the possibility
to enter the data points with the keyboard. First you have to enter the
number of wanted data points, then the X value and Y value of every data
point.
- Open data set(s)
This was already
discussed in the basic operations part.
- Open special
format
If the file to read is
a binary file, or if it consists
of more than two columns, or if the file has some lines to skip before the
actual data begins, you can set the properties of the data set with this panel.
If the file is so large that the processing of the graphs takes very long, you
can also perform data reduction during the file read process.
Once set, the program
remembers the special file settings while it is loaded. Every file that is
opened will then be opened using the special format, unless it is again disabled
with the disable button. Even when the program is ended and restarted the special format
settings will remain, as they are stored in the SpecView.ini file.
When you use a lot of different types of files, you can store the different
settings in presets.

Note: this image is from version 1.8. Since no
one reads a manual anyway, I haven't taken the effort yet to make new screen
shots and replace all the old ones. The images are all quite similar to the new
version. The manual text is updated correctly, however.
The special format
takes into account that a data file can consist of
-
binary data
-
more than two
columns of data
-
some initial
lines with general parameters
-
repeated data with
several measurements in one file
-
initial
“measurement-parameter” lines preceding every repeated data set
-
X can consist of
a time format (data logging files, for example)
-
too many data
points (resolution)
For some examples of
which files the program can read, take a look at the One
column example, Two column
example, 8 column example, Time
format example, Repeated
data example 1 and Repeated
data example 2 files. There are presets stored in Spectrum Viewer to read
these files.
To be able to display
these types of files you get the choice to:
-
Select the file type: text or binary.
-
Set the X column:
the column you would like to end up in the X axis (0 has the same
effect as opening a file with one column only, see basic operations).
-
Set the Y
column:
the column you would like to end up in the Y axis. 0 opens every
column in a separate data set.
-
Define if the X
column is in time format: when data logging, the X value can be a time format. The problem with
this format is, is that it consists of several (usually 2 or 3) columns of
digits, separated by a ":". When specifying that the X column represents a
time, you also have to specify the time format (H:M, M:S or H:M:S). The program
then calculates the number of minutes, or the number of seconds, for the X
value. Keep in mind,
when specifying the Y column, that the program still will see the time columns
as individual (two or three) columns.
-
Define if
the data file consists of repeated data
-
Define if
this repeated data belongs to one measurement or to several measurements
-
Define if you
want Data Reduction. If the number of data points in a file is so large that processing
afterwards becomes very slow, you can reduce the number of data points in
several ways. 1 - You can limit the number of data points in a
data set: all the data points which are read after the limit is reached are
discarded. 2 - You can skip a given number of data points at the
beginning of each file. 3 - You can discard a given number of
data points at the end of each file. 4 - You can automatically downsample
a data set after it is read from the file.
-
Auto
scale: Automatically set the gain or offset directly after reading
the file. Opposed to setting the gain on the axis itself, this will
alter the data.
-
Skip file
contents: "skip initial lines" defines the number of (text)lines to be
skipped at the beginning of the file.
"Skip repeated
lines" defines the number of lines to be skipped at the start of each “window”
of repeated data, when applicable.
-
Set the
default file names: The
“default file spec” setting determines the default file name that will
already be filled in in the “open file” dialog box.
If all your file names end on .dat, make the default file spec “*.dat”,
and the dialog box will only display the files actually ending on .dat in
the selected folder. Then you can open them all in one go by just pressing
ctrl-a.
If
you have several types of data files that end on different extensions, you
can use the “default file extensions” setting. For example, if your
measure files all end on “.meas.txt” or “.spec.txt” you could set
the default extensions line to “*.meas.txt;*.spec.txt” and these
extensions will appear in the “files of type” select box in the “open file”
dialog box. Thus you can switch easily between the files you want to display
in the dialog box.
-
Define a plug-in
name: If a data file is so complicated that even Spectrum Viewer can't read
it, you can write your own file converter. This converter will be loaded
each time a file is read, thus providing "native support" of that
file format. The converter should be an exe file, the first argument to it
should be the file to open, the second argument should be the file to write
to (SV will provide these names when the exe file is called). The format
written should be the Spectrum Viewer proprietary SVF format, for which I've
included a c-file and a h-file
to create.
-
Set the
default axis names and graph title: When a file is
opened with a special format setting, the axis names and graph title will be
changed according to this preset. When the fields are empty the axis names
be left untouched..
- Close selected
data sets / close all data
sets
Try it and see what
happens J
- Save data set /
Save data set as
After manipulation you
can save a data set with its original name, or with a new name. A data set is
always saved as a text file with two columns, the X axis as the left column and
the Y axis as the right column.
- Save all selected
in one file
This can be used to
save several data sets into one tab-separated, space-separated or comma-seperated ascii matrix file, or into one binary matrix file.

The formats available are
-
YYYY: Discards all X data. Puts the Y array of the first selected set in the
first column, and
all the Y arrays of the following selected data sets in the following columns.
-
X YYYY: Puts the X array of the first selected set in the first
column, the Y array of the first selected set in the 2nd column, and
all the Y arrays of the following selected data sets in the following columns.
-
XY XY XY: Puts The X and Y array of the first selected set in the
first two columns, the X and Y of the 2nd selected set in column 3
and 4, and so on.
-
Spectrum
Viewer format (.svf). This binary format preserves several Spectrum
Viewer specific data, like axis names. Mostly useful for programmers.
Note: instead of saving to a
file you can also generate a table from the data (View -> Table), then press
ctrl-a and ctrl-c. This way the data is copied into the clipboard and can be
pasted into most Windows programs.
-
Save session
This saves the state of the program into a Spectrum Viewer
format file. After opening this file you will see the exact same view as when
you saved it (Axis names, hidden plots, selected plots and all).
- Delete selected
data set(s) from disk
Unloads a selected
data set from memory and deletes the corresponding file from disk. Before
deleting, the program will select all the data sets from the file to delete, so
you can see what you're deleting, and asks for a confirmation. This can be handy to delete files of failed or unwanted
measurements. Be careful though, because once they’re gone, they’re gone!
- Print graph
Prints the graph.
Please note you can set the graph title, the X axis name,
the
Y axis name, the Grid color and
grid font, and the Legend and its font before
printing. The graph background color will be white when printing. Setting the
grid color to white will make the grid invisible on the print.
- Exit
Closes the program.
EDIT MENU

- Undo/Redo/ Levels
of undo
Up to 100 levels of
undo and redo are available. The default is 5
- Copy data set
-
to clipboard:
Copies a tab-separated table of the selected data sets into the
clipboard. This table can then be pasted into Excel or other table-oriented
programs. You can specify the format: XYXY, XYYY or YYYY
-
to another
data set: Creates a fresh copy
of the selected data set in the program. The copy is placed in the first empty data
set.
- Copy graph
bitmap to clipboard
Copies the graph bitmap
image to the
clipboard, so you can easily paste it into any program you like (don’t forget
to name the axes and the graph first if needed, just as when printing, see for
more details the print command). Originally I had the plan to
also give the option to export to .bmp, but since almost everybody would
immediately open the resulting file into a photo editor and save it as .jpg, I
thought it would be just as easy to just paste the graph into a photo editor
from the clipboard. Hence only the clipboard option. If someone desperately
needs the .bmp option, drop me a mail.
- Paste new data set(s)
from clipboard
Copies the contents of
the clipboard into new data sets. Columns should be separated by tabs, and rows should
be separated by newline characters. Most popular programs, Excel for one, copy
their matrix contents to the clipboard this way.
Since the program cannot know beforehand how the data is organized, you have to
choose between YYYY, XYYY and XYXY.
- Move data set
Moves the selected
data set to another place in the order. You can specify where the data set
should be placed (the default value is the first free data set).
- Trim data set(s)
Deletes all the
unnecessary data points from a plot. You have to give a range, and every data
point outside the range is discarded from the data set. You can select the
range by giving the correct X values, or by giving the exact data points. The
latter can be handy if the first or last few samples of a data set always
contain rubbish.
- Delete data
points
Deletes (discards or
interpolates, by your choice) all data points within a rectangle you just drew.
Handy for deleting single spikes from a plot. For data sets with a lot of spikes
it is better to choose the "delete large spikes" command in the
"smooth" menu. See also this
tutorial.
-
Delete specific Y values
Here you
have to define a band inside of which data points are invalid. These data
points will be discarded. The number of data points in the plot will decrease
with the number of discarded data points. You can use this if all invalid
measure data gets a specific Y value, zero for example.
- Select all sets
- Deselect all sets
Speaks for itself.
- Invert selection
Selects all sets that
are not selected, and de-selects all sets that are selected. Handy when, for
example, you want to delete all sets but one. Select the one you want to keep,
press <ctrl>-I and press <del> and you’re done.
- Sort selected
data set(s)
Sorts all the data
points of a plot by X-value. To see this in action, draw a new set as a
circle, and then sort it.
- Merge selected
data set(s)
Creates one new set
that contains all the data points of all selected sets, sorted by X value.
- Chop up selected
data set(s)
If your data set
consists of several measurements, you can chop it up so every measurement is in
its own data set. Then you can use "Position->Shift X->Shift first
element to" to position the sets underneath eachother, when desired.

- Delete raw data
block
This function is only useful when you work with self-defined
Spectrum Viewer files (.svf). These files can contain a custom data block which
is ignored by Spectrum Viewer (this block can contain measurement parameters or
raw data for example), but it will remain attached to the data set, so that when
saving the file again the data block is not discarded but will be saved as well.
If for some reason you want to discard this data block (for example, when a data
set is copied), this function does it for you.
POSITION MENU

- Shift X
Shifts the data set in
the X direction by the value you specify.
- Shift Y
Shifts the data set in
the Y direction by the value you specify. When you draw a "zooming
rectangle" (by clicking and dragging the mouse over the graph) before
selecting Shift Y, only the data points within the X range of the rectangle will
be affected.
- Multiply X
Multiplies the X value of all the data points of the selected set(s) by the factor you specify.
- Multiply Y
Multiplies the Y value of all the data points of the selected set(s) by the factor you specify.
When you draw a "zooming rectangle" before selecting Multiply Y, only
the data points within the X range of the rectangle will be affected.
- Drag plot
In this mode you can
pick up all selected plots with the mouse and place them anywhere on the graph.
The result is the same as with a Shift X or Shift Y operation, but now it is
done with the mouse instead of manually typing in the values you want to shift
by. In the top left corner the dragged amount is displayed, as well the
momentary value as the cumulative value (when several drags were done on the
same plot). In this mode the plots can also be shifted around by using the
cursor keys. Or, when you click on the indicators of the cumulative vector, you
can specify your own cumulative vector (entering X=0 and Y=0 here will result in
the plot jumping back to its original location). Exit this mode by escape or right-clicking with the mouse.
- Center Y
Deletes an offset on your plot by centering it around zero.
There are two ways to do this:
-
using the plot's minimum and maximum Y value: This is probably
best for clean (not noisy) plots. It
takes the Y value of the highest data point and the Y value of the lowest
data point, and shifts the plot so that its mean value is zero: Zero = (Ymax
+ Ymin) / 2
-
using the mean value of one period: Useful when your plot contains
spikes, in which case the above method will not work properly. This method
tries to determine the mean value of all the Y values of one complete
period, and then positions the plot around it. In order to determine the
length of one period you first have to draw a rectangle around one. This
rectangle doesn't need to be very tight, just try to draw a more or less
symmetrical rectangle around one period.
The program then will try to determine the actual zero crossings by itself.
Of the rectangle only the X values will be used as a starting point to find
the zero crossings, so the command can be used to center multiple plots with
different offsets at the same time, given that their periods are equal in
length. The noiser your plot is, the more erroneous the results of this
function can be, so take a bit of care to visually check if the centering
was done properly. You can always try to smooth a copy of your plot, center
it, and then shift the original plot with the same factor which was used
when centering the smoothed plot. This can be easily done,
because:
The shift factor
will be stored in the "Position -> Shift Y" default value, so
that you can later shift other plots with the same factor, when desired.
- Normalize Y
Multiplies the Y
values of a given plot in such a way that the largest value of the whole plot
becomes equal to a value you specify.
When you draw a "zooming rectangle" before selecting Normalize Y, only
the Y values of the data points within the X range of the rectangle will be used
to calculate the multiply factor, before the whole plot will be multiplied with
this factor. The factor itself will be stored in the "Position -> Multiply Y"
default value, so that you can later multiply other plots with the same factor
as well.
- Append selected
data sets
Creates one new set
that appends all selected sets, by shifting the X values of the original sets,
in a way that X2,first = X1,last + (X1,last –
X1,(last-1)), etc. They will be appended in a top-down order (the
upper selected data set first, the lowest last). If you need to append in
another order, you can use the move data set command.
- Swap X and Y axis
This function swaps the
X and Y axis of the selected set(s) only, not of the whole graph. Do this, and then a
sort operation, for an interesting effect.
SMOOTH MENU

- Average all
selected data sets into one

Creates one new data set
that contains all the data points of all selected sets, sorted by X value.
After this it downsamples the resulting data set by the number of sets that were
selected. See for the downsampling procedure the command below (Downsample,
average X and Y).
- Smooth
Averages the
Y-value of every data point with its neighbours. First you have to define
the width. The width is the number of data points on either side that will
be averaged into the current data point. So a width of 1 means that 3 data
points are averaged into one: the center data point, and the point left to
it, and the point right to it. A width of 2 means 5 data points are
averaged, and so on. The source points are taken from the original plot, not
the already processed plot. With a width of 2 the algorithm would be like
this:
Xnew,i = Xold,i
; Ynew,i = (Yold,i-2 + Yold,i-1
+ Yold,i + Yold,i+1 + Yold,i+2) / 5
- Downsample
(average X and Y)
This will reduce the
number of elements in a data set by taking their average. It will also smooth
the look of the data set, by compromising the resolution. You have to specify
the number by which the number of data points will be reduced. For example, if a
downsample-by-3 is performed then the following will take place:
Xnew,1 = (Xold,1 +
Xold,2
+ Xold,3) / 3; Ynew,1 = (Yold,1 + Yold,2 +
Yold,3) / 3
Xnew,2 = (Xold,4 +
Xold,5
+ Xold,6) / 3; Ynew,2 = (Yold,4 + Yold,5 +
Yold,6) / 3
So with a downsample
factor of three, the resolution will be cut in three as well.
- Downsample
overlapping parts
This can be used if the X distance of a data set is not
consistent. This can happen if 2 data sets are merged, or a data set consists of
2 partially overlapping measurements. In the overlapping part there will be more
data points per X value than in the non-overlapping part. With this function,
you can downsample these data points without downsampling the other data points
as well. You have to specify the "equidistant factor". If you specify
0.3 (the default), it means that when the next data point is closer than 0.3
times the x-distance of the previous point, it will be downsampled. For an
example of this function in action, open the TwoColumnExample28.txt file, zoom
in to the sawtooth part at 1/3 of the plot, and perform the "Downsample
overlapping parts" action. You will see that only the sawtooth is smoothed
and that the other data points are left alone.
- Upsample selected
data set(s)
Increases the number of
data points in a plot, by putting extra data points in between the original data
points. These extra points are interpolated (they are placed on the line that
connects the original data points). An upsample factor of 2 doubles the number
of data points (NB by putting ONE point in between the original points), a
factor of 3 triples it, etc.
- Resample selected
data set(s)
This function
resamples your plot to the number of data points you specify. It takes the first
data point and the last data point, and equally spreads out all the other data
points over your plot. Can be handy when your plots are not X-equidistant.
- Delete large
spikes
Deletes large spikes
on all selected data sets. For single spikes it might be faster to use the
"delete data points" option in the "Edit" menu, but for a
plot with many spikes this function can be very handy.
You have to define:
-
The maximum Y value: all points that exceed this value will be
discarded.
-
The minimum Y value: all points that are lower than this value will
be discarded.
-
The maximum Y value percentage
increase: all points on a plot that are higher than x% of the previous point will
be discarded. So a value of 200% means that the next point cannot be more than
twice as high as the previous point.
-
The minimum Y value percentage
decrease: all points on a plot that are x% lower than the previous point will be
discarded. So a value of 50% means that the next point cannot be less than half
the value of the previous point.
This
function will not change the number of data points in a plot. When an invalid
value is encountered (the "spike") the program will search within the
plot for the nearest valid value. When this is found, the program will draw a
line between the last valid point and the next valid point, and place all the
"out of spec" points on that line.
When
you first draw a rectangle, only the data points which fall within the rectangle
are processed.
- Delete offset
jumps
When your plot halfway
jumps to another offset value and continues from there, you can compensate for
that jump with this function. You have to give the maximum absolute Y
jump. If the plot exceeds this jump at a certain point, the jump value will be
subtracted from all following data points.
If the plot jumps up, and later jumps back, the shifted portion is put back into
place while the surrounding portions are left untouched.. For noisy plots you
can select a width higher than 1, then the jumping value will be calculated with
a mean value of the last few data points before the jump and after the jump.
When you first draw a
rectangle, only the data points which fall within the rectangle are processed.
ANALYZE MENU

- Differentiate
Calculates the
derivative of the selected graph(s). This can be done in two ways.
"Direct" calculates the derivative between two data points, and places
the result in the middle of them. It can be handy if you need to have
the derivative of every single data point in your graph, but the results can be
pretty noisy, and even erroneous if the X values aren't equidistant.
"Smoothed" on the other hand takes the derivative of the two points
surrounding a data point, and places the result over the data point in the
middle. This makes the result a lot less noisy, and is the preferred method to
use. By increasing the width factor you will increase the "number of data
points away from the point in the middle" from which the derivative will be
taken. The larger the width, the smoother the result will be, but very high
factors can give erroneous results. You have to experiment a bit to get the
optimum between smoothness and accuracy. To check if a derivative is correct,
integrate it after taking the derivative, you should get your original plot back
(apart from the starting offset which is lost by differentiating).
- Integrate
Calculates the sum of
the area of the selected graph, which is the inverse of a differentiation. This
function will calculate the area from the start of the plot until every data
point. This way you end up with a plot, not just one area value. The last data
point will contain the area of the whole graph this way. If you only need the
area of the whole plot (or a part of it), you can use the Area above X axis
command.
- Log, Power
Calculates log(y),
ln(y), 10y, ey and y??.
The last function can
also be used to take roots: y1/2 = sqrt(y), or divide by y: y-1
= 1/y.
- Absolute
value of Y
Converts all negative
values into positive values. Leaves the positive values alone.
- Area above X axis
Calculates the area of
a selected plot above the X-axis between a given range. The area appears at the
top of the graph. SumY means the sum of all Y values between the given range, Area
gives the actual area (calculated by the sum of the width x height of every
data point in the range).
- Area above line (peak area)

You draw a line between
two points by clicking on the graph once for each point, and then the program calculates the area of the selected plot above this line.
You can select different plots (by double clicking on the names at the right
side) while the same line stays active. Every time when just one data set is
selected, the area above the line is calculated and displayed. When more than
one set is selected, the display disappears, to re-appear again when just one
set is selected. This makes it easy to switch between plots while leaving the
same line active.
- Full Width Half
Max

Calculates the ful
width half max distance of a peak. The Y value of the peak is determined by
clicking on it (this way it also works with a bit noisy peaks). You have to do
this BEFORE you select the FWHM command. The program assumes that exact Y value
of your last click (displayed in the indicator at the top right of the graph) is
the max Y value of the peak. So click carefully, as the outcome of the FWHM
command will be as accurate as your click! The X value of your last click will
be the starting point from where the program will go down both legs of the peak.
This doesn't need to be as precise as the Y value, just as long as it falls
within the area of the half max distance line.
When the command is
given the program will go down both legs of the graph until it shoots through
half the peak value. When this happens it will draw a line between this last
data point (which is below half the max value) and the data point before
it (which should be above half the max value). Then it will determine the
exact X value where the line crosses the half peak value. It will calculate this
for both legs of the peak and then display the distance of these two X values.
- Histogram of Y
values
You have to specify
the number of bands (default 10) and the Y range within which the Y values wil
be counted. If the number of bands specified is very high, the resolution is
very high as well, but the number of values in one band will be very low. You
can fix this by downsampling in the way below:
- Downsample
(average X, add Y)
Especially made for histogram purposes. Normally,
downsampling takes the average of the X values as well as the average of the Y
values. In this case however, it takes the average of the X values and adds
the Y values. This way you can combine several histogram bands into one.
- Subtract plot

Subtract one selected
plot from another. This only works when exactly two plots are selected. The
subtract algorithm does the following: It first determines the common range of
the two plots. For this common range, it takes each point of the source plot
(SP), interpolates the y value of the plot to subtract (PTS) on the exact
x-location of the SP-point, then subtracts that PTS y-value from the SP y-value.
The resulting plot thus contains exact as many points as the SP (in the shared
range of the two plots), on the exact same x-locations.
If the PTS contains
many more points than the SP, then the resolution of the PTS would become lost
if it were subtracted. In order to prevent this, the SP is temporarily
upsampled if it contains less than half the points of the PTS in the shared
range.
- Add 2 selected
plots
Adds one selected
plot to another. This only works when exactly two plots are selected. The add
algorithm works exactly the same as the subtract algorithm above (as far as the number
of elements in the resulting plot is concerned), except that it adds two plots,
instead of subtracting them. The upper selected plot will always be the source
plot.
- Multiply Y of 2
selected plots
Multiplies one selected
plot with another. This only works when exactly two plots are selected. The
multiply algorithm works exactly the same as the subtract algorithm above (as far as
the number of elements in the resulting plot is concerned), except that it
multiplies two plots, instead of subtracting them. The upper selected plot will
always be the source plot.
- Divide Y of 2
selected plots
Divides one selected
plot by another. This only works when exactly two plots are selected. The divide algorithm works exactly the same as the subtract algorithm above (as far as
the number of elements in the resulting plot is concerned), except that it divides two plots, instead of subtracting them. The
plot above the divide line will be the source plot.
- Multiply Y with X
of the selected plots
Multiplies the Y value
of a data point with its X value.
This can be used, for example, with U-I plots
(U means voltage, I means current). By multiplying Y with X, you get U x I, which
means the power (P).
VIEW MENU

-
View only selected, Hide selected, Unhide all
Hidden
plots do not appear on the graph. Their names will still be present in the name
window in a thin font. Hidden plots can be very handy when working with a lot of
data sets simultaneously.
- Table
Will bring up a
table with all selected or all active data sets. You can choose between the
YYYY, XYYY or the XYXY
format (this works the same as in the Save all in one file command). It can be
handy to take a look at the actual data of your data set, but you can also use
it to export the data sets into other analysis programs by selecting all cells
(ctrl-a), then copying them into the clipboard (ctrl-v), switching to your other
analysis program (Excel for instance), and pasting the data into a worksheet
with ctrl-v. This is quicker than first saving it into a text file and then
importing it again. Please note to set the precision high enough in the table
menu, otherwise some resolution may be lost while copying and pasting.
- 2D intensity plot
-
View: This
will change the view from 1D single plot lines to a 2D picture of the Y
values of the data sets. Each line represents one data set. The X value will
be the X value of the original plots, the
Y value represents the data set to which the horizontal line belongs (you
can give these a more meaningful value by using the y-axis Gain
and Offset options), and
the color of the plot represents the Y value of the data set, where by
default black represents the lowest value and white represents the highest
value. If no set is selected, all sets will be displayed in the graph
window. If some sets are selected, only the selected plots will appear in
the graph window. In order to change the appearance of the plot you can set
the:
-
Custom
settings: Here you can set the values to which the different colors
belong, as well as the colors themselves. The "auto values" option
will set the lowest color to the lowest value present in the plot, the
highest color to the highest value present, and distribute all other colors
in between. A "smoothing" option is also present: when checked the
graph will smooth its appearance, to give the graph a less
"checkered" look. Tip: you can set these color values also when
you're in the 1D view mode. Looking at the plots in 1D mode can give you a
good clue to the values to which you want to set the different colors. Then,
switching to 2D mode the new settings will be instantly active.
- Trend
This will run a
"loop of selection", which means that all data sets will be selected
one by one, from the first one to the last one. This way, when you've
done several identical measurements, you can see the difference between them as
they get highlighted one by one. The delay time is the time that each plot will
stay selected before the next one is selected.
- Graph Title
Here you can enter the
graph title.
- Graph Legend
-
View legend: This
will produce a legend of the graph on the graph itself. Every plot will have
its own line, each of which can be dragged over the graph individually by
pressing CTRL and dragging the text line with the mouse. If you want to drag the
legend lines as a block you can drag just the topmost text line, then
disable the legend, and enable it again. The new text lines will appear
right underneath the topmost line. The
contents and color of a text line will be identical to the corresponding
name of the plot in the data set names window. You can set the names in that
window by right-clicking on any active name in it.
-
Legend font
style: if the graph window is sized, the legend text will be scaled to
it. In order to keep it readable you might need to adjust the font after
sizing the graph window.
- Graph Style
Here you can set the
graph background color and the grid color, as well as the axis indicator fonts, the axis name
fonts and the name panel font. You can make the grid
invisible by giving it the same color as the graph background (keep this in mind
when exporting the graph to a bitmap or printing it).
-
X-axis/Y-axis/Right Y-Axis:
-
Viewing range: Sets the viewing range of the graph. “Redraw” (F5) will undo this.
-
Reverse:
Will flip over (mirror) the plot.
-
Name: Names the corresponding axis.
-
Decimal precision: Gives the number of decimals to display on the axis values. By default
the program tries to set an optimal precision based on the content of the
data sets. If the precision is set manually, this setting will
overrule the auto setting as long as the program is loaded.
-
Toggle decimal/scientific format: Speaks for itself.
-
Gain: This one is a bit tricky. It multiplies the display of the given axis by
the number you specify. It does not alter the data. This can be useful
with data files that consist of one column. The X-values will be 0, 1, 2, 3,
etc. and setting a gain on the X axis can alter the display without altering
the data. Or, in 2D view mode, the gain can be used to give the Y
axis a more meaningful value.
-
Offset: As with the gain, it does not alter the data, it just offsets the axis
value.
- Show cursor
Displays a crosshair
cursor. This can come in handy when working with two Y-axes, to read the right
Y-axis values of a plot, since the decimal indicator on the top of the
screen only displays the Y value of the left Y axis.
- Redraw display
Re-sets the viewing
range to autoscale and re-draws all plots.
HELP MENU
- View
documentation
Loads this document.
- Reset all help
popups
When the program is
first started, all kinds of explaining popup windows show up when the user
performs an action. Every popup is only shown once, it will never appear again.
Until this command is selected.
-------------------------------------------------------------------------------------------------
Programmer's
section
CONTROLLING
SPECTRUM VIEWER WITH OTHER PROGRAMS, USING DDE
When writing a measuring program, you can use
Spectrum Viewer as your data display with DDE. First save the data file, open a
DDE connection to Spectrum Viewer and tell it to open the file automatically.
Working this way has two advantages:
-
Your file has to be saved in order for SV
to open it, so the data is already safe on disk when you see it displayed
-
You can instantly use all powerful SV
features (smoothing, spike elimination) on your data
When opening a connection to SV, use the
following parameters:
#define SV_DDE_NAME
"SV Server" /* server name */
#define SV_DDE_TOPIC "SV Client 1" /* topic of the conversation */
/* Commands supported by the server: */
#define SV_FILE_OPEN
"FileOpen"
#define SV_FILE_CLOSE "FileClose"
I have
included a C example file you
can use as a starting point to connect your own program with Spectrum Viewer.
THE SPECTRUM VIEWER FILE FORMAT (.svf)
Spectrum Viewer can read a lot of files. Text,
binary, you name it. Still I felt the need to create yet another proprietary
file format. Why? When SV exits, it saves its state (including all loaded data
sets) into the LastSession.svf file. When the program is restarted, it loads
this file and the program comes back exactly the way you left it. As demands
grew, so did the svf format, and finally it is mature enough to make its specs
public. You can even use the svf format to store your own data, and not use
Spectrum Viewer at all, but use your own programs to read it. In my opinion the
format is very versatile. The general specs are:
-
The file can contain multiple data sets,
all with x, y and z data (at present z data is ignored by Spectrum Viewer,
it is read and saved, however). The data format is binary 32-bit float.
Binary, so it reads fast (no need to convert strings to floats). I chose
float over double because it halves the file size and memory usage, speeds
up reading time and for most applications the double precision isn't needed
anyway.
-
Each data set can have its own file path,
axis names, graph name, data set name.
-
Each data set can have a text block with
info about the data set (e.g. measure parameters). This text block can be
seen (and edited) in the data set
style window, in the info text box.
-
Each data set can have an own data block
which will be ignored by SV. This data block can contain anything, raw data,
measure parameters, whatever you want to put in there. It won't affect the
display of the file in SV. The only thing you have to specify is the size of
the data block. SV reads the data block, attaches it to the data set and
saves it again when the data set is saved in svf format (so you won't lose
the data block when saving to another file). Of course, this data block is
only useful if you have written another program which knows what to do with
it, like a calibration program.
The exact structure of the SVF file is
described below. If you decide to use the format yourself, I have included SVF.h
and SVF.c as well so you can get started right away.
The exact structure of a .svf file is as
follows. First, there are the file parameters.
-
File version number, 4 chars. currently 0
0 0 1
-
Number of bytes to skip, unsigned int (4
bytes). Must be zero, unles you have a custom data block, then you have to
put its size in bytes here.
-
Custom data block. Can be anything, as
long as you give its correct size in the above parameter. SV will ignore
this block and skip over it. This is the FILE data block, each data set can
have its own custom data block as well.
-
XReverse, char, 1 byte, may be 1 or 0. If
this is 1 the X-axis display will be mirrored.
-
YReverse, char, 1 byte, may be 1 or 0.
-
YRReverse, char, 1 byte, may be 1 or 0.
-
NrOfDataSets, int, 4 bytes.
Then, for each data set the following block:
-
Number of bytes to skip, unsigned int (4
bytes). Must be zero, unles you have a custom data block, then you have to
put its size in bytes here.
-
Custom data block. Can be anything, as
long as you give its correct size in the above parameter. SV will ignore
this block and skip over it. This is the DATA SET data block.
-
DataPath, null-terminated string, max 255.
If not required one 0 byte (which in fact is a string with zero length). Can
be longer than 255, SV won't crash, but SV will chop off the string at 255
chars. DataPath is the physical path of the file name of the data set.
It is used in the "Delete file from disk" menu command, and with
the DDE "DSDelete"command. When 0, SV will fill in the name of the
file opened. When specified, SV will use the specified name. This name can
be different from the actual .svf file name this data set is in. This is
used for example in the LastSession.svf file, where the data path will not
point to the LastSession.svf file, but to its original file. When not sure
what to put in this field, make it 0 and everything will be allright.
-
DataSetName, string, max 252. If not
required one 0 byte. Can be longer than 252, but will be chopped off. This
is the name that will appear in the name window. When 0, SV will put the
file name in the name window
-
GraphTitle, max 255. If not required one 0
byte. Can be longer, etc.
-
XName, max 255. If not required one 0
byte. This is the name that will be given to the X-axis (like "Energy
(eV)"). When a .svf file is opened, SV will look at the axis names of
the first data set, and put them in place. When afterwards a data set is
selected SV will automatically read the axis names and put them in
place. This way you can display different data sets simultaneously, and
always have the correct description on the axes. When 0, SV will leave the
axes names as they were.
-
YName, max 255.
-
ZName, max 255. At present Z data is
ignored by SV, it is read and saved, however. I've put Z data in here for
future use.
-
DSInfo, max 1023. This is a text block
which can be viewed (and edited) in the data set style window, in the info
text block. Here you can put measure parameters which you need to be able to
see when displaying the file in SV.
-
Hidden, char, 1 byte, may be 1 or 0. If
this is 1, the file will be already hidden when opened.
-
Selected, char, 1 byte, may be 1 or 0.
-
RightYAxis, char, 1 byte, may be 1 or 0.
-
ZDataPresent, char, 1 byte, may be 1 or 0
-
NrOfDataPoints, int, 4 bytes
-
X[0], float, 4 bytes
-
Y[0], float, 4 bytes
-
if (ZDataPresent) Z[0], float 4 bytes
-
X[1], Y[1], Z[1], X[2], ....,
Z[NrOfDataPoints-1].
If
you're interested to use this format in your own programs, take a look at the SVF.h
file and the SVF.c file.
USING
PLUG-INS FOR NATIVE DATA FILE SUPPORT
When your data files have such an exotic format that even
Spectrum Viewer cannot read them anymore, you can write a plug-in converter
program which SV can call to convert the file to a format it can read. This
program should be an exe file which takes two arguments: the input file (the
file to convert) and the temporary output file. Both arguments will be generated
on-the-fly by SV when it calls the plug-in program.
When opening a file with a plug-in, the following happens.
You open the files in SV just like you used to, with the "open file"
dialog box. SV will now go down the file list you have created (all the selected
files), and will call the plug-in program for each file of the list. The plug-in
program will generate a converted temp file, SV will read the converted temp
file, and delete the converted temp file after reading. That way it will be like
the conversion never took place and SV did read your original data file from its
original location.
I've written an example
program which you can use as a skeleton for writing your own converter
programs. The compiled version of this program is called PluginFileConverter.exe,
and it is present in the SV program folder. You can test the use of this plug-in
converter program with the "Plug-in" preset on the "Open special
format" panel.
SPECVIEW.INI
Most of the settable
parameters (plot colors, special format
settings, working folders etc.) are
stored in the file SpecView.ini every time the program exits. It is again
loaded when the program is restarted. The SpecView.ini file is located in the
application data folder. This would typically be
C:\Documents and
Settings\username\Application Data\SpectrumViewer.
or C:\Windows\Application Data\SpectrumViewer.
Storing all the
settings on exit can sometimes be a disadvantage. For example, if you made a
mistake and gave all plots the red color (and forgot to undo it), the program
will remember this setting when it is restarted. If you don’t want to re-set
all the plot colors manually, you can delete the color lines in the
SpecView.ini file, leaving the other lines untouched. Next time the program
starts, it will assign its own default colors to the plots, while it still will
read the other parameters from the ini file as usual. If you delete the whole
ini file there’s no problem either, the program will assign its default values
to all parameters when it starts, and it will rewrite the ini file on exit.
Editing the ini file while the program is loaded is useless, as the program
will overwrite the file again when it exits.
COMMAND LINE ARGUMENTS
Some of the
SpecView.ini settings can also be given as command line arguments (they will
overrule the SpecView.ini settings). This can particularly be useful if you are
writing measuring software and want to launch the spectrum viewer from within
that program.
The command line
arguments are:
-
[File to open]. If present, this should always be the first
argument. The other ones may be in random order
-
"-D
[foldername]" defines the Application Data folder, where Specview.ini
will be stored
-
"-I [foldername]" defines the default working
folder
-
"-S [filespec]" defines the default file
specification, see open special format
-
"-E [file extensions]" defines the default
file extensions, see open special format
-
"-L [1/0]" defines whether or not the last
session file should be loaded (default 1)
The strings between brackets
should not have spaces in them, it might be necessary to use the Windows short
pathname format.
Without command line
arguments, the program defaults to the SpecView.ini file in the Windows
Application Data folder.
----------------------------------------------------------------------------------------------------
So there it is, the
Spectrum Viewer. Have fun with it, and if you have any suggestions about
additional functionality, or want to report a bug, don’t hesitate to mail me: erwintimmerman
at yahoo.co.uk
Erwin Timmerman