Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
BAORadio
AnaPAON4
Commits
b34a8efd
Commit
b34a8efd
authored
Jun 21, 2019
by
perdereau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds a python script + short readme
parent
c66825d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
186 additions
and
0 deletions
+186
-0
Python/README
Python/README
+6
-0
Python/cmp_simddat.py
Python/cmp_simddat.py
+180
-0
No files found.
Python/README
0 → 100644
View file @
b34a8efd
scripts in this folder :
viewtfmap.py (+mynormalize) : reading and f\plotting from t-f map
(or t-ra) fits files written by visiavg
cmp_simddat.py : to plot fitted and input tracks (visi vs time at some freq) used in the fitting of pointing & phase with satellites (and sources)
Python/cmp_simddat.py
0 → 100644
View file @
b34a8efd
from
astropy.io
import
fits
import
numpy
as
np
from
matplotlib
import
pyplot
as
plt
# use make_fig_scan(filename,numero_antenne,nombre_de_traces)
# to get plots of all autocor visi comparision between
# data and fitted results from trkacxfit
# this will also plot the difference (in gray, scale on the right)
# unused tracks are alsor plotted
# make_fig_scan_xc(filename,numero_antenne,nombre_de_traces)
# plots of all cross-cor visi comparision between
# data and fitted results from trkacxfitc (real and imag part)
# this will also plot the difference (in gray, scale on the right)
# for the real part
# unused tracks are alsor plotted
#cx_1_check_gal.fits
keynam
=
'HIERARCH NOM_OBJET'
def
myplot_xcor
(
hdul
,
i
):
plt
.
clf
()
plt
.
plot
(
hdul
[
i
].
data
,
label
=
'Real'
)
plt
.
plot
(
hdul
[
i
+
1
].
data
,
label
=
'Imag'
)
plt
.
plot
(
hdul
[
i
+
2
].
data
,
label
=
'simu(real)'
)
plt
.
plot
(
hdul
[
i
+
3
].
data
,
label
=
'simu(imag)'
)
plt
.
legend
()
def
myplot_ac
(
hdul
,
i
):
plt
.
clf
()
print
hdul
[
i
].
header
[
keynam
]
print
hdul
[
i
+
1
].
header
[
keynam
]
plt
.
plot
(
hdul
[
i
].
data
,
label
=
'Signal'
)
plt
.
plot
(
hdul
[
i
+
1
].
data
,
label
=
'Simu'
)
plt
.
legend
()
def
get_num
(
nant
,
ntrk
,
tot
):
ntims
=
tot
ntrks
=
2
*
tot
oft
=
(
nant
-
1
)
*
(
ntrks
)
+
ntims
print
nant
print
'oft ='
+
str
(
oft
)
idt
=
2
*
(
ntrk
-
1
)
# track no starts at 1
print
"idt="
+
str
(
idt
)
if
nant
==
1
:
#antenna no starts at 1
print
idt
idt
=
idt
+
ntrk
#tims
print
idt
else
:
idt
=
idt
+
oft
print
idt
return
idt
def
get_num_cx
(
nant
,
ntrk
,
tot
):
ntims
=
tot
ntrks
=
4
*
tot
oft
=
(
nant
-
1
)
*
(
ntrks
)
+
ntims
print
nant
print
'oft ='
+
str
(
oft
)
idt
=
4
*
(
ntrk
-
1
)
# track no starts at 1
print
idt
if
nant
==
1
:
#antenna no starts at 1
print
idt
idt
=
idt
+
ntrk
#tims
print
idt
else
:
idt
=
idt
+
oft
print
idt
return
idt
def
myplot_acn
(
hdul
,
nant
,
ntrk
,
tot
):
i
=
get_num
(
nant
,
ntrk
,
tot
)
plt
.
clf
()
print
hdul
[
i
].
header
[
keynam
]
print
hdul
[
i
+
1
].
header
[
keynam
]
plt
.
plot
(
hdul
[
i
].
data
,
label
=
'Signal'
)
plt
.
plot
(
hdul
[
i
+
1
].
data
,
label
=
'Simu'
)
plt
.
legend
()
def
myplot_xcorn
(
hdul
,
nant
,
ntrk
,
tot
):
i
=
get_num_cx
(
nant
,
ntrk
,
tot
)
print
hdul
[
i
].
header
[
keynam
]
print
hdul
[
i
+
1
].
header
[
keynam
]
print
hdul
[
i
+
2
].
header
[
keynam
]
print
hdul
[
i
+
3
].
header
[
keynam
]
plt
.
clf
()
plt
.
plot
(
hdul
[
i
].
data
,
label
=
'Real'
)
plt
.
plot
(
hdul
[
i
+
1
].
data
,
label
=
'Imag'
)
plt
.
plot
(
hdul
[
i
+
2
].
data
,
label
=
'simu(real)'
,
linestyle
=
":"
)
plt
.
plot
(
hdul
[
i
+
3
].
data
,
label
=
'simu(imag)'
,
linestyle
=
":"
)
plt
.
legend
()
def
make_fig_scan
(
ffnam
,
ant
,
ntot
):
hda
=
fits
.
open
(
ffnam
)
nrows
=
np
.
int
(
np
.
sqrt
(
ntot
))
ncols
=
ntot
/
nrows
ncols
=
ncols
+
ntot
-
ncols
*
nrows
print
str
(
nrows
)
+
" "
+
str
(
ncols
)
#plt.figure(figsize=(20,17))
f
,
axarr
=
plt
.
subplots
(
nrows
,
ncols
,
figsize
=
(
ncols
*
4
,
nrows
*
4
))
axarf
=
axarr
.
flatten
()
f
.
suptitle
(
'Antenna '
+
str
(
ant
))
for
ip
in
np
.
arange
(
ntot
):
i
=
get_num
(
ant
,
ip
+
1
,
ntot
)
print
hda
[
i
].
header
[
keynam
]
print
hda
[
i
+
1
].
header
[
keynam
]
axarf
[
ip
].
plot
(
hda
[
i
].
data
,
label
=
'Signal'
)
axarf
[
ip
].
plot
(
hda
[
i
+
1
].
data
,
label
=
'Simu'
)
axarf
[
ip
].
legend
()
vscale
=
np
.
max
(
hda
[
i
].
data
)
-
1.
vmin
=
1
-
0.2
*
vscale
vmax
=
(
1.
+
vscale
)
*
1.1
axarf
[
ip
].
set_ylim
((
vmin
,
vmax
))
axarf
[
ip
].
set_title
(
'Track '
+
str
(
ip
))
axarf
[
ip
].
set
(
xlabel
=
'time (mn)'
,
ylabel
=
'signal (AU)'
)
ax2
=
axarf
[
ip
].
twinx
()
ax2
.
plot
(
hda
[
i
].
data
-
hda
[
i
+
1
].
data
,
label
=
'Data-Simu'
,
color
=
'gray'
)
ax2
.
set_ylim
((
-
1
,
9
))
ax2
.
legend
(
loc
=
2
)
plt
.
tight_layout
()
plt
.
subplots_adjust
(
top
=
0.9
)
def
make_fig_scan_xc
(
ffnam
,
ant
,
ntot
):
hda
=
fits
.
open
(
ffnam
)
nrows
=
np
.
int
(
np
.
sqrt
(
ntot
))
ncols
=
ntot
/
nrows
ncols
=
ncols
+
ntot
-
ncols
*
nrows
print
str
(
nrows
)
+
" "
+
str
(
ncols
)
f
,
axarr
=
plt
.
subplots
(
nrows
,
ncols
,
figsize
=
(
ncols
*
4
,
nrows
*
4
))
axarf
=
axarr
.
flatten
()
f
.
suptitle
(
'Antenna '
+
str
(
ant
))
for
ip
in
np
.
arange
(
ntot
):
i
=
get_num_cx
(
ant
,
ip
+
1
,
ntot
)
print
hda
[
i
].
header
[
keynam
]
print
hda
[
i
+
1
].
header
[
keynam
]
#axarf[ip ].plot(hda[i].data,label='Signal')
#axarf[ip ].plot(hda[i+1].data,label='Simu')
#axarf[ip ].legend()
axarf
[
ip
].
plot
(
hda
[
i
].
data
,
label
=
'Real'
)
axarf
[
ip
].
plot
(
hda
[
i
+
1
].
data
,
label
=
'Imag'
)
axarf
[
ip
].
plot
(
hda
[
i
+
2
].
data
,
label
=
'simu(real)'
,
linestyle
=
":"
)
axarf
[
ip
].
plot
(
hda
[
i
+
3
].
data
,
label
=
'simu(imag)'
,
linestyle
=
":"
)
axarf
[
ip
].
legend
()
vmaxr
=
np
.
max
(
hda
[
i
].
data
)
*
1.2
vminr
=
np
.
min
(
hda
[
i
].
data
)
*
1.2
vmaxi
=
np
.
max
(
hda
[
i
+
1
].
data
)
*
1.2
vmini
=
np
.
min
(
hda
[
i
+
1
].
data
)
*
1.2
vmax
=
np
.
max
((
vmaxr
,
vmaxi
))
vmin
=
np
.
min
((
vminr
,
vmini
))
axarf
[
ip
].
set_ylim
((
vmin
,
vmax
))
axarf
[
ip
].
set_title
(
'Track '
+
str
(
ip
))
axarf
[
ip
].
set
(
xlabel
=
'time (mn)'
,
ylabel
=
'signal (AU)'
)
ax2
=
axarf
[
ip
].
twinx
()
ax2
.
plot
((
hda
[
i
].
data
-
hda
[
i
+
2
].
data
)
/
(
vmax
-
vmin
),
label
=
'Data-Simu (real)'
,
color
=
'gray'
)
ax2
.
set_ylim
((
-
1
,
1
))
ax2
.
legend
(
loc
=
3
)
plt
.
tight_layout
()
plt
.
subplots_adjust
(
top
=
0.9
)
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