Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Massana Zapata, Pol Dr (PG/R - Physics)
astro_lab
Commits
533ca7b7
Commit
533ca7b7
authored
Jan 18, 2019
by
Delorme, Maxime Dr (Physics)
Browse files
Moved the global parameters to function parameters
parent
6a99a0bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
astro_lab.py
View file @
533ca7b7
...
...
@@ -26,14 +26,6 @@ eff_gain = 0.0
error
=
None
bg_sub
=
False
# Parameters
sclip
=
3.0
# Sigma clipping
bg_wsize
=
50
# Backgroudn window size
aperture_r
=
3.0
# Radius of the circular aperture
sky_in
=
6.0
# Sky annulus inner-ring radius
sky_out
=
8.0
# Sky annulus outer-ring radius
mod_fit_size
=
10
# Size of the Moffat fitting window
def
open_file
(
filename
):
global
data
,
h0
,
h1
,
eff_gain
,
bg_sub
...
...
@@ -82,7 +74,7 @@ def plot_data(zscale=True):
plt
.
imshow
(
data
,
cmap
=
'Greys_r'
,
vmin
=
lims
[
0
],
vmax
=
lims
[
1
],
origin
=
'lower'
)
plt
.
show
()
def
subtract_background
(
plot
=
False
):
def
subtract_background
(
bg_wsize
=
50
,
sclip
=
3.0
,
plot
=
False
):
global
data
,
error
,
bg_sub
sigma_clip
=
SigmaClip
(
sigma
=
sclip
)
bkg_estimator
=
MedianBackground
()
...
...
@@ -96,7 +88,7 @@ def subtract_background(plot=False):
print
(
'Background successfully subtracted'
)
nx
,
ny
=
0
,
0
# Forced to include this in onclick
def
find_center
(
x
,
y
,
plot
=
True
,
contour
=
True
):
def
find_center
(
x
,
y
,
mod_fit_size
=
10
,
plot
=
True
,
contour
=
True
):
global
nx
,
ny
x_min
=
x
-
mod_fit_size
x_max
=
x
+
mod_fit_size
...
...
@@ -156,7 +148,7 @@ def find_center(x, y, plot=True, contour=True):
return
nx
,
ny
def
compute_photometry
(
x
,
y
):
def
compute_photometry
(
x
,
y
,
aperture_r
=
3.0
,
sky_in
=
6.0
,
sky_out
=
8.0
):
print
(
'Computing photometry at : '
,
x
,
y
)
# Aperture photometry : https://photutils.readthedocs.io/en/stable/aperture.html
pos
=
[(
x
,
y
)]
...
...
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