-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathamoy-spectral-analysis.sh
More file actions
53 lines (43 loc) · 1.37 KB
/
Copy pathamoy-spectral-analysis.sh
File metadata and controls
53 lines (43 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#-----------------------------------------------
#-----------------------------------------------
### Define user-paths for convenience
export DATAFOLDER=/home/amoy/xnav/nicer-data/B1937+21
export CODESFOLDER=/home/amoy/xnav/codes
#-----------------------------------------------
#-----------------------------------------------
### Loop over the ObsIds in the data set,
### and merge the various files required for
### making the pulse profile
ls $DATAFOLDER > $CODESFOLDER/obsids.txt
mapfile -t < $CODESFOLDER/obsids.txt # get list of ObsIDs as array
for i in "${MAPFILE[@]}"
do
cd "$DATAFOLDER" || exit
export CWD=$DATAFOLDER/$i # Current Working Directory
export CURAUX=$CWD/auxil # Current auxil Directory
export CURXTI=$CWD/xti # Current xti Directory
echo
echo "--------------------------------------------------------"
echo "*******Looping ... Currently processing ObsID $i*******"
echo "--------------------------------------------------------"
nicerl2 indir=$i clobber=YES
nicerl3-spect indir=$i clobber=YES
echo
# Find the _load.xcm file
LOAD_XCM=$(find "$CURXTI/event_cl" -type f -name "*_load.xcm")
if [[ -f "$LOAD_XCM" ]]; then
xspec <<EOF
@$LOAD_XCM
cd $i
cpd spect-$i/ps
setplot energy
setplot rebin 1 2
plot ldata
cpd none
exit
EOF
else
echo "File *_load.xcm not found for ObsID $i"
fi
done