Skip to content

Commit f3039ab

Browse files
committed
function definitions updated
1 parent 80a0701 commit f3039ab

File tree

5 files changed

+105
-15
lines changed

5 files changed

+105
-15
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# RamanSpec_BasicOperations
2-
This repository contains the procedures for the mentioned job needed in day to day analysis of spectra which can be, for example, Raman or IR spectra etc... The procedures are for analyzing raw data (x,y columns) of data loaded in Igor-Pro application. (Python codes for the same will be added later).
32

4-
1. `average_2D.ipf` : Procedure to average selected 2-D waves in a folder keep the averaged data in the 'averaged data' folder. More than one 2-D wave maybe selected.
3+
This repository contains procedures for the analysis of spectra. These can be, for example, Raman or IR spectra or others. The procedures are for analyzing raw data (x,y columns) of data loaded in IgorPro application.
54

6-
2. `plot_2D.ipf` : Takes a 2D wave and plots all the individual columns against the points, with some constant off set, or wavemax dependent offset.
5+
Refer to the few lines before each function to understand the purpose and the scheme. Edits might be needed for the correct usage of a function depending on the dataset.
76

8-
3. `analysis.ipf` : A set of procedures for analysis of waves.
9-
a) function = standard_dev_eachPnt_spectra : takes a set of waves, calculate the mean and std dev (1 sigma) and % error at each point of the wave.
10-
11-
4. `add_offset.ipf` : Two functions therein. One applies a constant offset to a traces on a plot ( offset is defined manually). Second, the offset is calculated such that two traces will never touch each other.
7+
Question and suggestions are welcome via the Issues tab.
8+
9+
***
10+
11+
## Citing this repository

folder_operations/extract_from_folders.ipf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11

2-
32
//*************************************************************
43
//*************************************************************
54

65
// Extract data from a wave (having same name) in all subfolders and place in a 2D wave
7-
// Argument : name of the wave, Example, "data1"
6+
// along the columns
7+
8+
// Argument : name of the wave,
9+
// For example, "data1"
810

911

1012
Function extract_data_from_subfolders (name)
@@ -57,7 +59,7 @@ Function extract_data_from_subfolders (name)
5759
make /o /d /n=(nRows, index) output
5860

5961

60-
// iterate over the folders and keep the wave in the 2D destination
62+
// iterate over the folders and keep the wave in the 2D wave as the destination
6163
index2=0
6264
do
6365
objName = GetIndexedObjNameDFR(dfr, 4, index2)
@@ -87,7 +89,7 @@ Function extract_data_from_subfolders (name)
8789
while(index2 < index)
8890

8991
setdatafolder dfr
90-
print "done."
92+
print "\tdone."
9193
End
9294

9395
//*************************************************************

folder_operations/folder_contents.ipf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
21
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
32

43

54
//*************************************************************
65
//*************************************************************
76

8-
// to print name of all waves in the current data folder
7+
// Print name of all waves in the current data folder
98

109
Function PrintAllWaveNames()
1110
String objName
@@ -23,7 +22,13 @@ End
2322

2423
//*************************************************************
2524
//*************************************************************
26-
// to print name of all subfolders in the current data folder
25+
// Print name of all subfolders in the current data folder
26+
27+
// Arguments :
28+
// startingDFR , for example, root:
29+
// level , for exmaple, 0 or 1
30+
31+
// PrintDataFolderPaths( root:, 0)
2732

2833
Function PrintDataFolderPaths(startingDFR, level)
2934
DFREF startingDFR

loading_data/load_all_txt.ipf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// For each loaded file, a new folder is created in the databrowser
1111
// the column in the txt file is loaded as waves ( autonamed as the header)
1212

13-
function load_all_txt_files()
13+
function loadTXT_files_all()
1414

1515
String s
1616

@@ -49,6 +49,8 @@ function load_all_txt_files()
4949
print folder_name
5050

5151
newdatafolder /o/s $folder_name
52+
53+
// /A=Auto, /J = delimited text, /W = header as name, /D=double precision
5254
LoadWave /A /J /W /D /P=path fileName;
5355

5456
setdatafolder savedDF

merge_2D.ipf

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//**************************************************************
2+
//**************************************************************
3+
4+
// To merge any number of 2D waves selected in the data browser
5+
// Output is generated in the same folder as "mergedWave2D"
6+
7+
// Usage : select waves in the data browser and run the command
8+
9+
function merge_2Dwaves_to_2D()
10+
11+
string name1
12+
variable j, jmax , k
13+
variable rows, columns
14+
variable x1,x2
15+
variable totalCol
16+
variable counter
17+
18+
19+
// purpose is to count the number of waves selected
20+
do
21+
name1 = GETBROWSERSELECTION(j)
22+
wave wav1=$name1
23+
if(strlen(name1)<=0)
24+
break
25+
endif
26+
x1=dimsize(wav1,0)
27+
j=j+1
28+
while(1)
29+
jmax=j // jmax is the number of selected waves
30+
31+
make /o /d /n=(jmax) tempCol
32+
wave tempCol
33+
34+
print tempCol
35+
j=0
36+
// purpose is to count the number of columns per wave selected
37+
do
38+
name1 = GETBROWSERSELECTION(j)
39+
wave wav1=$name1
40+
if(strlen(name1)<=0)
41+
break
42+
endif
43+
columns=dimsize(wav1,1)
44+
print columns
45+
tempCol [j] = columns
46+
47+
counter=counter+columns
48+
j=j+1
49+
while(1)
50+
51+
52+
// print counter
53+
54+
// Construct and assign the 2D wave
55+
make /o /d /n=(x1, counter) mergedWave2D=0
56+
wave mergedWave=mergedWave2D
57+
58+
counter=0
59+
// Assign the columns of data
60+
for (j=0 ; j < jmax ; j=j+1)
61+
62+
name1 = GETBROWSERSELECTION(j)
63+
wave wav1=$name1
64+
columns = tempCol [j]
65+
66+
for ( k=0 ; k < columns ; k=k+1)
67+
68+
// print j, k, name1, counter
69+
mergedWave[][ counter ] = wav1[p][k]
70+
counter=counter+1
71+
endfor
72+
endfor
73+
74+
totalCol = dimsize (mergedWave, 1)
75+
printf "\tProcess finished. 'mergedWave2D' created as output with dimensions : %g x %g.\r", x1, totalCol
76+
77+
killwaves /Z tempCol
78+
end
79+
80+
//**************************************************************
81+
//**************************************************************

0 commit comments

Comments
 (0)