Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maoppy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
LAM-GRD-public
maoppy
Commits
b1fe1ac5
Commit
b1fe1ac5
authored
3 years ago
by
rfetick
Browse files
Options
Downloads
Patches
Plain Diff
use super() for subclasses, use __str__
parent
ce8b303e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
maoppy/instrument.py
+1
-1
1 addition, 1 deletion
maoppy/instrument.py
maoppy/psfmodel.py
+17
-11
17 additions, 11 deletions
maoppy/psfmodel.py
with
18 additions
and
12 deletions
maoppy/instrument.py
+
1
−
1
View file @
b1fe1ac5
...
...
@@ -78,7 +78,7 @@ class Instrument:
self
.
phasemask_shift
=
(
0.0
,
0.0
)
self
.
_phasemask
=
None
def
__
rep
r__
(
self
):
def
__
st
r__
(
self
):
s
=
"
---------------------------------
\n
"
s
+=
self
.
fullname
+
"
\n
"
s
+=
"
---------------------------------
\n
"
...
...
This diff is collapsed.
Click to expand it.
maoppy/psfmodel.py
+
17
−
11
View file @
b1fe1ac5
...
...
@@ -226,20 +226,27 @@ class ParametricPSF:
Not to be instantiated, only serves as a referent for subclasses
"""
def
__init__
(
self
,
npix
):
def
__init__
(
self
,
nparam
,
npix
):
"""
Parameters
----------
npix : tuple of two elements
Model X and Y pixel size when called
"""
if
type
(
npix
)
!=
tuple
:
if
not
isinstance
(
nparam
,
int
):
raise
TypeError
(
"
Argument `nparam` must be an integer
"
)
if
not
isinstance
(
npix
,
tuple
):
raise
TypeError
(
"
Argument `npix` must be a tuple
"
)
self
.
npix
=
npix
self
.
bounds
=
()
self
.
_nparam
=
nparam
self
.
bounds
=
((
-
np
.
inf
,)
*
nparam
,
(
np
.
inf
,)
*
nparam
)
def
__repr__
(
self
):
return
"
ParametricPSF of size (%u,%u)
"
%
self
.
npix
def
__str__
(
self
):
s
=
"
ParametricPSF
\n
"
s
+=
"
-------------
\n
"
s
+=
"
pixels : (%u,%u)
\n
"
%
self
.
npix
s
+=
"
nb param: %u
"
%
self
.
_nparam
return
s
def
__call__
(
self
,
*
args
,
**
kwargs
):
raise
ValueError
(
"
ParametricPSF is not made to be instantiated. Better use its subclasses
"
)
...
...
@@ -287,9 +294,8 @@ class ConstantPSF(ParametricPSF):
With such a formalism, a constant PSF is just a particular case of a parametric PSF
"""
def
__init__
(
self
,
image_psf
):
super
().
__init__
(
np
.
shape
(
image_psf
))
super
().
__init__
(
0
,
np
.
shape
(
image_psf
))
self
.
image_psf
=
image_psf
self
.
bounds
=
()
def
__call__
(
self
,
*
args
,
**
kwargs
):
return
self
.
image_psf
...
...
@@ -297,8 +303,8 @@ class ConstantPSF(ParametricPSF):
class
Moffat
(
ParametricPSF
):
"""
Moffat PSF model
"""
def
__init__
(
self
,
npix
,
norm
=
np
.
inf
):
s
elf
.
npix
=
npix
def
__init__
(
self
,
npix
,
norm
=
np
.
inf
):
s
uper
().
__init__
(
4
,
npix
)
self
.
norm
=
norm
bounds_down
=
[
_EPSILON
,
_EPSILON
,
-
np
.
inf
,
1
+
_EPSILON
]
bounds_up
=
[
np
.
inf
for
i
in
range
(
4
)]
...
...
@@ -329,8 +335,8 @@ class Moffat(ParametricPSF):
class
Gaussian
(
ParametricPSF
):
"""
Gaussian PSF model
"""
def
__init__
(
self
,
npix
):
s
elf
.
npix
=
npix
def
__init__
(
self
,
npix
):
s
uper
().
__init__
(
3
,
npix
)
bounds_down
=
[
_EPSILON
,
_EPSILON
,
-
np
.
inf
]
bounds_up
=
[
np
.
inf
for
i
in
range
(
3
)]
self
.
bounds
=
(
bounds_down
,
bounds_up
)
...
...
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