logviewer.h

Go to the documentation of this file.
00001 /* Gnome gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  *
00005  * Gxsm Tool Name: logviewer.h
00006  * ========================================
00007  * 
00008  * Copyright (C) 2001 The Free Software Foundation
00009  *
00010  * Authors: Thorsten Wagner <thorsten.wagner@uni-essen.de> 
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00025  */
00026 
00027 #ifndef __LOGVIEWER_H
00028 #define __LOGVIEWER_H
00029 
00031 // incluedes                                //
00033 
00034 #include "WSxM_header.h"        // Header definition files (modified) provieded by www.nanotec.es
00035 #include <iostream>
00036 #include <fstream>
00037 #include <glib-2.0/glib.h>
00038 
00039 using namespace std;
00041 //      enum SourceChannelEnum               //
00043 enum SourceChannelEnum {
00044         Zmon, Umon, ADC5, ADC0, ADC1, ADC2, ADC3, ADC4, ADC6, ADC7, LockIn1st, LockIn2nd, LockIn0, END 
00045 };
00046         
00048 // Typedef SourceChannelStruc                //
00050 typedef struct SourceChannelStruc {
00051     enum SourceChannelEnum number; 
00052     gchar *name;
00053     gchar *aliasname;
00054     gint size;
00055     gdouble scaling;
00056     gint bitcoding;
00057 };
00058 
00060 //      enum FileTypeEnum                    // 
00062 //      Make changes here, if WSxM_header.h  //
00063 //      is alternated!!!                     //
00065 enum FileTypeEnum {
00066     TOPO, CITS, CITM, IV, IZ, ZV, FZ, generic
00067 };
00068 
00070 // Typedef ProbeStruc                //
00072 typedef struct ProbeStruc {
00073     enum FileTypeEnum FileTypeNumber;
00074     enum SourceChannelEnum xchannel;
00075     enum SourceChannelEnum ychannel;
00076 };
00077 
00079 // object declarations                       //
00081 class probedata {
00082         private:
00083           gint m;                                                                                       // number of data points per spectra to hold
00084     GPtrArray *points;                                          // data points within a spectra
00085     gdouble scalefactor;                                        // dig. units * scalefactor = real units
00086   public:
00087                 probedata(gdouble scale, gint datapoints);      // constructor
00088     ~probedata();                                                                       // destructor
00089     void addpoint(glong point);         // adding a point (in dig. units) to the dataset
00090     glong getpoint(glong index);        // reading back a point
00091     gdouble getvalue(glong index);      // reading back a point in real values
00092     gint count();                                                               // returns the number of data points
00093     gchar xpos[WSXM_MAXCHARS];          // used to store x position, may be obsolent soon
00094     gchar ypos[WSXM_MAXCHARS];          // used to store y position, may be obsolent soon
00095 };
00096 
00097 class scandata {
00098         private:
00099                 gint n;                                                                                                 // number of spectra to hold
00100     enum SourceChannelEnum channel;     // type of souce challen
00101     GPtrArray *spectra;                                                         // array of spectra
00102   public:
00103     scandata(guint spectras = 0, enum SourceChannelEnum source = ADC5); // constructor
00104     ~scandata();                                                                                        // destructor
00105     void addspectra();                                                          // adding a new spectra to the data set
00106     gint count();                                                                               // returns the number of spectra within the dataset
00107     GString *getchannel();                                              // returns the channel name as a string
00108     probedata *getspectrum(gint i=-1);  // returns a spectra
00109     glong getmax(gint layer);                           // returns the maximum over all spectra (in dig. units)
00110     glong getmin(gint layer);                           // returns the minimum over all spectra (in dig. units)
00111     gdouble getmaxvalue (gint layer); //returns the maximum over all spectra (in real units)
00112     gdouble getminvalue (gint layer); //returns the minimum over all spectra (in real units)
00113 };
00114 
00116 // Table Source Channel Coding               //
00118 SourceChannelStruc SourceChannels[] = {
00119   // SourceChannelEnum, Channel name, Channel string, Scaling factor, Channel coding,
00120         {Zmon, "Zmon", "Zmon-AIC5Out", 2, 4.0/65536., 0x01},
00121   {Umon, "Umon", "Umon-AIC6Out", 2, 4.0/65536., 0x02},
00122   {ADC5, "ADC5", "AIC5-I", 2, 20/65536., 0x10},
00123         {ADC0, "ADC0", "AIC0", 2, 20./65536., 0x20},
00124         {ADC1, "ADC1", "AIC1", 2, 20./65536., 0x40},
00125   {ADC2, "ADC2", "AIC2", 2, 20./65536., 0x80},
00126         {ADC3, "ADC3", "AIC3", 2, 20./65536., 0x100},
00127         {ADC4, "ADC4", "AIC4", 2, 20./65536., 0x200},
00128         {ADC6, "ADC6", "AIC6", 2, 20./65536., 0x400},
00129         {ADC7, "ADC7", "AIC7", 2, 20./65536., 0x800},
00130         {LockIn1st, "LockIn1st", "LockIn1s", 4, 20./(65536.*65536.), 0x1000},
00131         {LockIn2nd, "LockIn2nd", "LockIn2nd", 4, 20./(65536.*65536.), 0x2000},
00132         {LockIn0, "LockIn0", "LockIn0", 4, 20./(65536.*65536.),0x4000},
00133         {END, NULL, NULL, 0, 0, 0}
00134 };
00135 
00137 // Table Probe Channels                      //
00139 ProbeStruc ProbeChannelDefault[] = {
00140     // FileTypeEnum, default x-channel (enum), default y-channel (enum)
00141         {TOPO, END, END},
00142         {CITS, Umon, ADC5},
00143   {CITM, Umon, ADC5},
00144   {IV, Umon, ADC5},
00145   {IZ, Zmon, ADC5},
00146   {ZV, Zmon, Umon},
00147   {FZ, Zmon, ADC5},
00148   {generic, ADC1, ADC0}
00149  };
00150 
00151 
00153 // function declarations                     //
00155 int main(int argc, char *argv[]);
00156 GArray *getintsfromstring(gchar * string);
00157 scandata *getscan(GPtrArray * ptrarray, gint i);
00158 int writeIVs(gchar * fileprefix, scandata * scanx, scandata * scany, gdouble xfactor = 1.0, gdouble yfactor = 1.0 );
00159 
00160 #endif

Generated on Sat Apr 1 09:04:28 2006 for GXSM by  doxygen 1.4.6