Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
binary_c-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
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
Izzard, Robert Dr (Maths & Physics)
binary_c-python
Commits
f5d57687
Commit
f5d57687
authored
4 years ago
by
David Hendriks
Browse files
Options
Downloads
Patches
Plain Diff
fixing somee test things
parent
018af634
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
binarycpython/tests/test_c_bindings.py
+2
-2
2 additions, 2 deletions
binarycpython/tests/test_c_bindings.py
binarycpython/tests/test_grid.py
+24
-20
24 additions, 20 deletions
binarycpython/tests/test_grid.py
with
26 additions
and
22 deletions
binarycpython/tests/test_c_bindings.py
+
2
−
2
View file @
f5d57687
...
...
@@ -48,7 +48,7 @@ def return_argstring(
# Make the argstrings
argstring_template
=
"
binary_c M_1 {0:g} M_2 {1:g} separation {2:g} orbital_period {3:g}
\
eccentricity {4:g} metallicity {5:g} max_evolution_time {6:g} ensemble 1 ensemble_defer {7}
\
ensemble_filters_off {8} ensemble_filter_{9} 1 probability 0.1
"
ensemble_filters_off {8} ensemble_filter_{9} 1 probability 0.1
ensemble_dt 1000
"
argstring
=
argstring_template
.
format
(
m1
,
...
...
@@ -176,7 +176,7 @@ class TestEnsemble(unittest.TestCase):
output
=
_binary_c_bindings
.
return_persistent_data_memaddr
()
self
.
assertTrue
(
is_capsule
(
output
),
msg
=
"
Object must be a
n integer
"
)
self
.
assertTrue
(
is_capsule
(
output
),
msg
=
"
Object must be a
capsule
"
)
# self.assertNotEqual(
# output, 0, "memory adress seems not to have a correct value"
# )
...
...
This diff is collapsed.
Click to expand it.
binarycpython/tests/test_grid.py
+
24
−
20
View file @
f5d57687
...
...
@@ -10,8 +10,6 @@ import os
import
sys
import
json
import
unittest
import
tempfile
import
datetime
import
numpy
as
np
from
binarycpython.utils.grid
import
Population
...
...
@@ -26,6 +24,7 @@ from binarycpython.utils.custom_logging_functions import binary_c_log_code
binary_c_temp_dir
=
temp_dir
()
TEST_VERBOSITY
=
1
def
parse_function_test_grid_evolve_2_threads_with_custom_logging
(
self
,
output
):
"""
...
...
@@ -103,10 +102,10 @@ class test_Population(unittest.TestCase):
"""
test_pop
=
Population
()
test_pop
.
set
(
amt_cores
=
2
)
test_pop
.
set
(
amt_cores
=
2
,
verbosity
=
TEST_VERBOSITY
)
test_pop
.
set
(
M_1
=
10
)
test_pop
.
set
(
data_dir
=
"
/tmp/binary_c_python
"
)
test_pop
.
set
(
ensemble_filter_SUPERNOVAE
=
1
)
test_pop
.
set
(
ensemble_filter_SUPERNOVAE
=
1
,
ensemble_dt
=
1000
)
self
.
assertIn
(
"
data_dir
"
,
test_pop
.
custom_options
)
self
.
assertEqual
(
test_pop
.
custom_options
[
"
data_dir
"
],
"
/tmp/binary_c_python
"
)
...
...
@@ -139,7 +138,7 @@ class test_Population(unittest.TestCase):
# Set up population
test_pop
=
Population
()
test_pop
.
set
(
data_dir
=
"
/tmp
"
)
test_pop
.
set
(
data_dir
=
"
/tmp
"
,
verbosity
=
TEST_VERBOSITY
)
# parse arguments
test_pop
.
parse_cmdline
()
...
...
@@ -170,7 +169,7 @@ class test_Population(unittest.TestCase):
# Set up population
test_pop
=
Population
()
test_pop
.
set
(
metallicity
=
0.02
)
test_pop
.
set
(
metallicity
=
0.02
,
verbosity
=
TEST_VERBOSITY
)
test_pop
.
set
(
M_1
=
10
)
argline
=
test_pop
.
_return_argline
()
...
...
@@ -241,7 +240,7 @@ class test_Population(unittest.TestCase):
"""
test_pop
=
Population
()
test_pop
.
set
(
metallicity
=
0.02
)
test_pop
.
set
(
metallicity
=
0.02
,
verbosity
=
TEST_VERBOSITY
)
test_pop
.
set
(
M_1
=
10
)
test_pop
.
set
(
amt_cores
=
2
)
test_pop
.
set
(
data_dir
=
"
/tmp
"
)
...
...
@@ -340,7 +339,7 @@ class test_Population(unittest.TestCase):
test_pop
=
Population
()
test_pop
.
set
(
metallicity
=
0.02
)
test_pop
.
set
(
metallicity
=
0.02
,
verbosity
=
TEST_VERBOSITY
)
test_pop
.
set
(
M_1
=
10
)
test_pop
.
set
(
amt_cores
=
2
)
test_pop
.
set
(
data_dir
=
binary_c_temp_dir
)
...
...
@@ -486,7 +485,7 @@ class test_Population(unittest.TestCase):
M_2
=
5
,
orbital_period
=
100000
,
metallicty
=
0.02
,
max_evolution_time
=
15000
,
max_evolution_time
=
15000
,
verbosity
=
TEST_VERBOSITY
)
test_pop
.
set
(
C_logging_code
=
CUSTOM_LOGGING_STRING_MASSES
)
...
...
@@ -505,7 +504,7 @@ class test_Population(unittest.TestCase):
M_2
=
5
,
orbital_period
=
100000
,
metallicty
=
0.02
,
max_evolution_time
=
15000
,
max_evolution_time
=
15000
,
verbosity
=
TEST_VERBOSITY
)
test_pop_2
.
set
(
C_auto_logging
=
custom_logging_dict
)
...
...
@@ -533,7 +532,7 @@ class test_grid_evolve(unittest.TestCase):
test_pop_evolve_1_thread
=
Population
()
test_pop_evolve_1_thread
.
set
(
amt_cores
=
1
,
verbosity
=
0
,
M_2
=
1
,
orbital_period
=
100000
amt_cores
=
1
,
M_2
=
1
,
orbital_period
=
100000
,
verbosity
=
TEST_VERBOSITY
)
resolution
=
{
"
M_1
"
:
10
}
...
...
@@ -569,7 +568,7 @@ class test_grid_evolve(unittest.TestCase):
"""
test_pop
=
Population
()
test_pop
.
set
(
amt_cores
=
2
,
verbosity
=
1
,
M_2
=
1
,
orbital_period
=
100000
)
test_pop
.
set
(
amt_cores
=
2
,
M_2
=
1
,
orbital_period
=
100000
,
verbosity
=
TEST_VERBOSITY
)
resolution
=
{
"
M_1
"
:
10
}
...
...
@@ -611,12 +610,13 @@ class test_grid_evolve(unittest.TestCase):
test_pop
.
set
(
amt_cores
=
amt_cores_value
,
verbosity
=
1
,
verbosity
=
TEST_VERBOSITY
,
M_2
=
1
,
orbital_period
=
100000
,
data_dir
=
data_dir_value
,
C_logging_code
=
custom_logging_string
,
# input it like this.
parse_function
=
parse_function_test_grid_evolve_2_threads_with_custom_logging
,
)
test_pop
.
set
(
ensemble
=
0
)
resolution
=
{
"
M_1
"
:
2
}
...
...
@@ -667,7 +667,7 @@ class test_grid_evolve(unittest.TestCase):
"""
test_pop
=
Population
()
test_pop
.
set
(
amt_cores
=
2
,
verbosity
=
1
,
M_2
=
1
,
orbital_period
=
100000
)
test_pop
.
set
(
amt_cores
=
2
,
M_2
=
1
,
orbital_period
=
100000
,
verbosity
=
TEST_VERBOSITY
)
# Set the amt of failed systems that each thread will log
test_pop
.
set
(
failed_systems_threshold
=
4
)
...
...
@@ -719,7 +719,7 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n",
# test to see if 1 thread does all the systems
test_pop
=
Population
()
test_pop
.
set
(
amt_cores
=
2
,
verbosity
=
1
,
M_2
=
1
,
orbital_period
=
100000
)
test_pop
.
set
(
amt_cores
=
2
,
M_2
=
1
,
orbital_period
=
100000
,
verbosity
=
TEST_VERBOSITY
)
test_pop
.
set
(
failed_systems_threshold
=
4
)
test_pop
.
set
(
C_logging_code
=
CUSTOM_LOGGING_STRING_WITH_EXIT
)
...
...
@@ -771,7 +771,7 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n",
"""
test_pop
=
Population
()
test_pop
.
set
(
amt_cores
=
1
,
verbosity
=
1
,
M_2
=
1
,
orbital_period
=
100000
)
test_pop
.
set
(
amt_cores
=
1
,
M_2
=
1
,
orbital_period
=
100000
,
verbosity
=
TEST_VERBOSITY
)
resolution
=
{
"
M_1
"
:
10
}
self
.
assertRaises
(
ValueError
,
test_pop
.
evolve
)
...
...
@@ -791,13 +791,14 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n",
test_pop
=
Population
()
test_pop
.
set
(
amt_cores
=
amt_cores_value
,
verbosity
=
1
,
verbosity
=
TEST_VERBOSITY
,
M_2
=
1
,
orbital_period
=
100000
,
ensemble
=
1
,
ensemble_defer
=
1
,
ensemble_filters_off
=
1
,
ensemble_filter_STELLAR_TYPE_COUNTS
=
1
,
ensemble_dt
=
1000
,
)
test_pop
.
set
(
data_dir
=
binary_c_temp_dir
,
...
...
@@ -864,13 +865,14 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n",
test_pop
=
Population
()
test_pop
.
set
(
amt_cores
=
amt_cores_value
,
verbosity
=
1
,
verbosity
=
TEST_VERBOSITY
,
M_2
=
1
,
orbital_period
=
100000
,
ensemble
=
1
,
ensemble_defer
=
1
,
ensemble_filters_off
=
1
,
ensemble_filter_STELLAR_TYPE_COUNTS
=
1
,
ensemble_dt
=
1000
,
)
test_pop
.
set
(
data_dir
=
binary_c_temp_dir
,
...
...
@@ -921,13 +923,14 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n",
test_pop_1
=
Population
()
test_pop_1
.
set
(
amt_cores
=
amt_cores_value
,
verbosity
=
1
,
verbosity
=
TEST_VERBOSITY
,
M_2
=
1
,
orbital_period
=
100000
,
ensemble
=
1
,
ensemble_defer
=
1
,
ensemble_filters_off
=
1
,
ensemble_filter_STELLAR_TYPE_COUNTS
=
1
,
ensemble_dt
=
1000
,
)
test_pop_1
.
set
(
data_dir
=
binary_c_temp_dir
,
...
...
@@ -959,13 +962,14 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n",
test_pop_2
=
Population
()
test_pop_2
.
set
(
amt_cores
=
amt_cores_value
,
verbosity
=
1
,
verbosity
=
TEST_VERBOSITY
,
M_2
=
1
,
orbital_period
=
100000
,
ensemble
=
1
,
ensemble_defer
=
1
,
ensemble_filters_off
=
1
,
ensemble_filter_STELLAR_TYPE_COUNTS
=
1
,
ensemble_dt
=
1000
,
)
test_pop_2
.
set
(
data_dir
=
binary_c_temp_dir
,
...
...
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