Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-haz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-haz
Commits
eae77beb
Commit
eae77beb
authored
7 years ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
updated reult generator
parent
fe66da72
No related branches found
No related tags found
1 merge request
!259
Subduction basin term update; Zhao06 coeffs and site term smoothing
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gov/usgs/earthquake/nshmp/gmm/GmmTest.java
+14
-7
14 additions, 7 deletions
test/gov/usgs/earthquake/nshmp/gmm/GmmTest.java
with
14 additions
and
7 deletions
test/gov/usgs/earthquake/nshmp/gmm/GmmTest.java
+
14
−
7
View file @
eae77beb
...
@@ -9,7 +9,6 @@ import com.google.common.base.Function;
...
@@ -9,7 +9,6 @@ import com.google.common.base.Function;
import
com.google.common.base.StandardSystemProperty
;
import
com.google.common.base.StandardSystemProperty
;
import
com.google.common.collect.FluentIterable
;
import
com.google.common.collect.FluentIterable
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.io.Files
;
import
com.google.common.io.Resources
;
import
com.google.common.io.Resources
;
import
com.google.common.primitives.Doubles
;
import
com.google.common.primitives.Doubles
;
...
@@ -17,6 +16,10 @@ import java.io.File;
...
@@ -17,6 +16,10 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -60,11 +63,14 @@ public class GmmTest {
...
@@ -60,11 +63,14 @@ public class GmmTest {
}
}
/* Use to generate Gmm result file */
/* Use to generate Gmm result file */
static
void
generateResults
(
Set
<
Gmm
>
gmms
,
Set
<
Imt
>
imts
,
String
inputsFileName
,
static
void
generateResults
(
Set
<
Gmm
>
gmms
,
Set
<
Imt
>
imts
,
String
inputsFileName
,
String
resultsFileName
)
throws
IOException
{
String
resultsFileName
)
throws
IOException
{
List
<
GmmInput
>
inputs
=
loadInputs
(
inputsFileName
);
List
<
GmmInput
>
inputs
=
loadInputs
(
inputsFileName
);
File
out
=
new
File
(
"tmp/Gmm-tests/"
+
resultsFileName
);
List
<
String
>
lines
=
new
ArrayList
<>();
Files
.
write
(
""
,
out
,
StandardCharsets
.
UTF_8
);
for
(
Gmm
gmm
:
gmms
)
{
for
(
Gmm
gmm
:
gmms
)
{
for
(
Imt
imt
:
imts
)
{
for
(
Imt
imt
:
imts
)
{
GroundMotionModel
gmModel
=
gmm
.
instance
(
imt
);
GroundMotionModel
gmModel
=
gmm
.
instance
(
imt
);
...
@@ -76,12 +82,13 @@ public class GmmTest {
...
@@ -76,12 +82,13 @@ public class GmmTest {
Lists
.
newArrayList
(
modelIndex
++
+
"-"
+
id
,
Lists
.
newArrayList
(
modelIndex
++
+
"-"
+
id
,
String
.
format
(
"%.6f"
,
Math
.
exp
(
sgm
.
mean
())),
String
.
format
(
"%.6f"
,
Math
.
exp
(
sgm
.
mean
())),
String
.
format
(
"%.6f"
,
sgm
.
sigma
())),
String
.
format
(
"%.6f"
,
sgm
.
sigma
())),
Delimiter
.
COMMA
)
+
Delimiter
.
COMMA
);
StandardSystemProperty
.
LINE_SEPARATOR
.
value
();
lines
.
add
(
result
);
Files
.
append
(
result
,
out
,
StandardCharsets
.
UTF_8
);
}
}
}
}
}
}
Path
out
=
Paths
.
get
(
"tmp/Gmm-tests/"
,
resultsFileName
);
Files
.
write
(
out
,
lines
,
StandardCharsets
.
UTF_8
);
}
}
static
List
<
Object
[]>
loadResults
(
String
resource
)
throws
IOException
{
static
List
<
Object
[]>
loadResults
(
String
resource
)
throws
IOException
{
...
...
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