Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
astro_lab
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Massana Zapata, Pol Dr (Maths & Physics)
astro_lab
Commits
eae07bb7
Commit
eae07bb7
authored
6 years ago
by
Delorme, Maxime Dr (Physics)
Browse files
Options
Downloads
Patches
Plain Diff
Decoupled data and subtracted data
parent
533ca7b7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
astro_lab.py
+14
-8
14 additions, 8 deletions
astro_lab.py
with
14 additions
and
8 deletions
astro_lab.py
+
14
−
8
View file @
eae07bb7
...
...
@@ -19,6 +19,7 @@ import os, sys, warnings
# Objects
data
=
None
data_sub
=
None
h0
=
None
h1
=
None
zs
=
ZScaleInterval
()
...
...
@@ -66,16 +67,21 @@ def get_parameter(param_name):
return
None
def
plot_data
(
zscale
=
True
):
if
bg_sub
:
pdata
=
data_sub
else
:
pdata
=
data
if
zscale
:
lims
=
zs
.
get_limits
(
data
)
lims
=
zs
.
get_limits
(
p
data
)
else
:
lims
=
[
data
.
min
(),
data
.
max
()]
lims
=
[
p
data
.
min
(),
p
data
.
max
()]
plt
.
imshow
(
data
,
cmap
=
'
Greys_r
'
,
vmin
=
lims
[
0
],
vmax
=
lims
[
1
],
origin
=
'
lower
'
)
plt
.
imshow
(
p
data
,
cmap
=
'
Greys_r
'
,
vmin
=
lims
[
0
],
vmax
=
lims
[
1
],
origin
=
'
lower
'
)
plt
.
show
()
def
subtract_background
(
bg_wsize
=
50
,
sclip
=
3.0
,
plot
=
False
):
global
data
,
error
,
bg_sub
global
data
,
error
,
data_sub
,
bg_sub
sigma_clip
=
SigmaClip
(
sigma
=
sclip
)
bkg_estimator
=
MedianBackground
()
bkg
=
Background2D
(
data
,
(
bg_wsize
,
bg_wsize
),
sigma_clip
=
sigma_clip
,
bkg_estimator
=
bkg_estimator
)
...
...
@@ -83,7 +89,7 @@ def subtract_background(bg_wsize=50, sclip=3.0, plot=False):
plt
.
imshow
(
bkg
.
background
,
origin
=
'
lower
'
,
cmap
=
'
Greys_r
'
)
plt
.
show
()
error
=
calc_total_error
(
data
,
bkg
.
background_rms
,
eff_gain
)
data
=
data
-
bkg
.
background
data
_sub
=
data
-
bkg
.
background
bg_sub
=
True
print
(
'
Background successfully subtracted
'
)
...
...
@@ -95,10 +101,10 @@ def find_center(x, y, mod_fit_size=10, plot=True, contour=True):
y_min
=
y
-
mod_fit_size
y_max
=
y
+
mod_fit_size
window
=
data
[
y_min
:
y_max
+
1
,
x_min
:
x_max
+
1
]
window
=
data
_sub
[
y_min
:
y_max
+
1
,
x_min
:
x_max
+
1
]
# Initial guess
z0
=
data
[
y
,
x
]
z0
=
data
_sub
[
y
,
x
]
m_init
=
models
.
Moffat2D
(
z0
,
x
,
y
)
manual_pick
=
False
...
...
@@ -161,7 +167,7 @@ def compute_photometry(x, y, aperture_r=3.0, sky_in=6.0, sky_out=8.0):
print
(
'
Performing photometry measures without error model
'
)
phot_table
=
aperture_photometry
(
data
,
apers
)
else
:
phot_table
=
aperture_photometry
(
data
,
apers
,
error
)
phot_table
=
aperture_photometry
(
data
_sub
,
apers
,
error
)
# Mean sky subtraction
bkg_mean
=
phot_table
[
'
aperture_sum_1
'
]
/
annulus_apertures
.
area
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment