Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rapthor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
rapthor
Commits
8c36ddd8
Commit
8c36ddd8
authored
2 years ago
by
Frits Sweijen
Browse files
Options
Downloads
Patches
Plain Diff
Filter on infs when normalising gains
parent
8ef319b9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
rapthor/scripts/process_slow_gains.py
+17
-0
17 additions, 0 deletions
rapthor/scripts/process_slow_gains.py
with
17 additions
and
0 deletions
rapthor/scripts/process_slow_gains.py
+
17
−
0
View file @
8c36ddd8
...
@@ -93,6 +93,14 @@ def normalize_direction(soltab, remove_core_gradient=True, solset=None, ref_id=0
...
@@ -93,6 +93,14 @@ def normalize_direction(soltab, remove_core_gradient=True, solset=None, ref_id=0
for
s
in
range
(
len
(
station_names
)):
for
s
in
range
(
len
(
station_names
)):
if
'
CS
'
in
station_names
[
s
]
and
s
!=
ref_id
:
if
'
CS
'
in
station_names
[
s
]
and
s
!=
ref_id
:
if
not
np
.
all
(
np
.
isnan
(
parms
[:,
:,
s
,
dir
,
:])):
if
not
np
.
all
(
np
.
isnan
(
parms
[:,
:,
s
,
dir
,
:])):
nmean
=
np
.
nanmean
(
parms
[:,
:,
s
,
dir
,
:])
if
not
np
.
isfinite
(
nmean
):
print
(
'
WARNING: mean is NaN or inf, attempting again using only finite values.
'
)
x
=
np
.
where
(
np
.
isfinite
(
parms
[:,
:,
s
,
dir
,
:]),
parms
[:,
:,
s
,
dir
,
:],
np
.
nan
)
nmean
=
np
.
nanmean
(
x
)
# Still failed, this shouldn't happen, give up.
if
not
np
.
isfinite
(
nmean
):
raise
ValueError
(
'
Mean value for station {:s} is NaN or infinite!
'
.
format
(
station_names
[
s
]))
mean_vals
.
append
(
np
.
nanmean
(
parms
[:,
:,
s
,
dir
,
:]))
mean_vals
.
append
(
np
.
nanmean
(
parms
[:,
:,
s
,
dir
,
:]))
dist_vals
.
append
(
dist
[
s
])
dist_vals
.
append
(
dist
[
s
])
stat_names
.
append
(
station_names
[
s
])
stat_names
.
append
(
station_names
[
s
])
...
@@ -119,6 +127,15 @@ def normalize_direction(soltab, remove_core_gradient=True, solset=None, ref_id=0
...
@@ -119,6 +127,15 @@ def normalize_direction(soltab, remove_core_gradient=True, solset=None, ref_id=0
# times, frequencies, and pols
# times, frequencies, and pols
for
dir
in
range
(
len
(
soltab
.
dir
[:])):
for
dir
in
range
(
len
(
soltab
.
dir
[:])):
norm_factor
=
np
.
nanmean
(
parms
[:,
:,
:,
dir
,
:][
initial_unflagged_indx
[:,
:,
:,
dir
,
:]])
norm_factor
=
np
.
nanmean
(
parms
[:,
:,
:,
dir
,
:][
initial_unflagged_indx
[:,
:,
:,
dir
,
:]])
if
not
np
.
isfinite
(
norm_factor
):
print
(
'
WARNING: mean is NaN or inf, attempting again using only finite values!
'
)
parms_temp
=
parms
[:,
:,
:,
dir
,
:][
initial_unflagged_indx
[:,
:,
:,
dir
,
:]]
x
=
np
.
where
(
np
.
isfinite
(
parms_temp
),
parms_temp
,
np
.
nan
)
norm_factor
=
np
.
nanmean
(
x
)
# Still failed, this shouldn't happen, give up.
if
not
np
.
isfinite
(
norm_factor
):
raise
ValueError
(
'
Normalisation factor for direction {:s} is NaN or infinite!
'
.
format
(
soltab
.
dir
[
dir
]))
parms
[:,
:,
:,
dir
,
:]
-=
norm_factor
parms
[:,
:,
:,
dir
,
:]
-=
norm_factor
# Convert back to non-log values and make sure flagged solutions are still flagged
# Convert back to non-log values and make sure flagged solutions are still flagged
...
...
This diff is collapsed.
Click to expand it.
Frits Sweijen
@sweijen
mentioned in issue
#5 (closed)
·
2 years ago
mentioned in issue
#5 (closed)
mentioned in issue #5
Toggle commit list
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