Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
BAORadio
AnaPAON4
Commits
f13b3aab
Commit
f13b3aab
authored
Jul 17, 2015
by
Reza ANSARI
Browse files
Ajout programme p4conv2fits.cc - conversion en FITS des fichiers de visibilites PPF, Reza 17/7/2015
parent
9661689e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
1 deletion
+141
-1
makefile
makefile
+10
-1
p4conv2fits.cc
p4conv2fits.cc
+131
-0
No files found.
makefile
View file @
f13b3aab
...
...
@@ -3,7 +3,7 @@
include
$(SOPHYABASE)/include/sophyamake.inc
# Define our target list
all
:
Objs/rdvisip4 Objs/visi2ntac Objs/visi2dtacx Objs/visi2tmfreq
all
:
Objs/rdvisip4 Objs/visi2ntac Objs/visi2dtacx Objs/visi2tmfreq
Objs/p4conv2fits
clean
:
rm
-f
Objs/
*
...
...
@@ -40,6 +40,15 @@ Objs/rdvisip4 : Objs/rdvisip4.o Objs/visip4reader.o
Objs/rdvisip4.o
:
rdvisip4.cc visip4reader.h
$(CXXCOMPILE)
-o
Objs/rdvisip4.o rdvisip4.cc
######
## programme de conversion de matrices de visibilites de PPF en FITS
Objs/p4conv2fits
:
Objs/p4conv2fits.o Objs/p4conv2fits.o
$(CXXLINK)
-o
Objs/p4conv2fits Objs/p4conv2fits.o
$(SOPHYAEXTSLBLIST)
Objs/p4conv2fits.o
:
p4conv2fits.cc
$(CXXCOMPILE)
-o
Objs/p4conv2fits.o p4conv2fits.cc
######
Objs/visip4reader.o
:
visip4reader.cc visip4reader.h
$(CXXCOMPILE)
-o
Objs/visip4reader.o visip4reader.cc
...
...
p4conv2fits.cc
0 → 100644
View file @
f13b3aab
// Utilisation de SOPHYA pour faciliter les tests ...
#include "sopnamsp.h"
#include "machdefs.h"
/* ----------------------------------------------------------
Projet BAORadio/PAON4 - (C) LAL/IRFU 2008-2015
Programme de lecture des fichiers matrices de
visibilites au format PPF et conversion au format FITS
R. Ansari Juillet 2015
---------------------------------------------------------- */
// include standard c/c++
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <string>
#include "pexceptions.h"
#include "tarray.h"
#include "fioarr.h"
#include "arrctcast.h"
#include "tarrinit.h"
#include "timestamp.h"
#include <utilarr.h>
#include "ctimer.h"
#include "timing.h"
#include "fitsioserver.h"
/* --Fonction-- */
int
Usage
(
bool
fgea
)
{
cout
<<
" --- p4con2fits.cc : Read visibility matrices produced by mfacq in PPF format and write them in fits
\n
"
<<
endl
;
if
(
fgea
)
cout
<<
" p4con2fits: Missing or wrong argument ! "
<<
endl
;
cout
<<
" Usage: p4con2fits InPathBAO5 InPathBAO6 Imin,Imax,step OutDir [PrintLev=1]
\n
"
<<
" InPathBAO5/6: path for input vismtx_J_iii.ppf on bao5/6
\n
"
<<
" Imin,Imax,step : read files for Imin<=iii<=Imax iii+=step
\n
"
<<
endl
;
return
1
;
}
//----------------------------------------------------
//----------------------------------------------------
int
main
(
int
narg
,
char
*
arg
[])
{
if
((
narg
>
1
)
&&
(
strcmp
(
arg
[
1
],
"-h"
)
==
0
))
return
Usage
(
false
);
if
(
narg
<
5
)
return
Usage
(
true
);
string
path5
=
arg
[
1
];
string
path6
=
arg
[
2
];
int
Imin
,
Imax
,
Istep
;
sscanf
(
arg
[
3
],
"%d,%d,%d"
,
&
Imin
,
&
Imax
,
&
Istep
);
string
outdir
=
arg
[
4
];
int
prtlev
=
0
;
if
(
narg
>
5
)
prtlev
=
atoi
(
arg
[
5
]);
cout
<<
" p4con2fits/Info: Path BAO5:"
<<
path5
<<
" BAO6:"
<<
path6
<<
"
\n
"
<<
" Imin,max,step="
<<
Imin
<<
","
<<
Imax
<<
","
<<
Istep
<<
" OutDir="
<<
outdir
<<
" PrtLev="
<<
prtlev
<<
endl
;
TArrayInitiator
_inia
;
FitsIOServerInitiator
_inifio
;
int
rc
=
0
;
try
{
char
cmd
[
512
];
sprintf
(
cmd
,
"mkdir %s/BAO5"
,
outdir
.
c_str
());
int
rcc
=
system
(
cmd
);
cout
<<
" executed: "
<<
cmd
<<
" ->Rc="
<<
rcc
<<
endl
;
sprintf
(
cmd
,
"mkdir %s/BAO6"
,
outdir
.
c_str
());
rcc
=
system
(
cmd
);
cout
<<
" executed: "
<<
cmd
<<
" ->Rc="
<<
rcc
<<
endl
;
char
infile
[
1024
];
char
outfile
[
512
];
int
cnt
=
0
;
for
(
int
k
=
0
;
k
<
4
;
k
++
)
{
for
(
int
i
=
Imin
;
i
<=
Imax
;
i
++
)
{
for
(
int
j
=
0
;
j
<
2
;
j
++
)
{
if
(
j
==
0
)
{
sprintf
(
infile
,
"%s/vismtx_%d_%d.ppf"
,
path5
.
c_str
(),
k
,
i
);
sprintf
(
outfile
,
"%s/%s/vismtx_%d_%d.fits"
,
outdir
.
c_str
(),
"BAO5"
,
k
,
i
);
}
else
{
sprintf
(
infile
,
"%s/vismtx_%d_%d.ppf"
,
path6
.
c_str
(),
k
,
i
);
sprintf
(
outfile
,
"%s/%s/vismtx_%d_%d.fits"
,
outdir
.
c_str
(),
"BAO6"
,
k
,
i
);
}
PInPersist
pp
(
infile
);
TArray
<
complex
<
r_4
>
>
vis
;
pp
>>
vis
;
FitsInOutFile
ff
(
outfile
,
FitsInOutFile
::
Fits_Create
);
TArray
<
r_4
>
fvis
=
ArrCastC2R
(
vis
);
fvis
.
Info
()
=
vis
.
Info
();
ff
<<
fvis
;
if
(
i
==
Imin
)
{
cout
<<
" p4con2fits/Info - Visibility matrix size from the first file:"
<<
endl
;
vis
.
Show
();
fvis
.
Show
();
}
cnt
++
;
if
((
prtlev
>
0
)
||
(
i
==
Imin
)
||
(
i
%
10
==
0
))
cout
<<
cnt
<<
"- "
<<
infile
<<
" ---> "
<<
outfile
<<
endl
;
}
}
}
cout
<<
" p4con2fits: "
<<
cnt
<<
" PPF files converted to fits"
<<
endl
;
rc
=
0
;
}
catch
(
PException
&
exc
)
{
cerr
<<
" p4con2fits.cc catched PException "
<<
exc
.
Msg
()
<<
endl
;
rc
=
77
;
}
catch
(
std
::
exception
&
sex
)
{
cerr
<<
"
\n
p4con2fits.cc std::exception :"
<<
(
string
)
typeid
(
sex
).
name
()
<<
"
\n
msg= "
<<
sex
.
what
()
<<
endl
;
rc
=
78
;
}
catch
(...)
{
cerr
<<
" p4con2fits.cc catched unknown (...) exception "
<<
endl
;
rc
=
79
;
}
cout
<<
">>>> p4con2fits.cc ------- END ----------- RC="
<<
rc
<<
endl
;
return
rc
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment