From 50e1612da2f57f97593b97272d17df28b9a73553 Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Fri, 17 Jan 2020 15:24:53 +0000
Subject: [PATCH] moved a part to general examples, and added some custom
 logging snippets

---
 examples/examples.py                | 36 +++++++++++++++++
 examples/examples_custom_logging.py | 60 ++++++-----------------------
 2 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/examples/examples.py b/examples/examples.py
index e81878fd7..83b1a6886 100644
--- a/examples/examples.py
+++ b/examples/examples.py
@@ -103,6 +103,42 @@ def run_example_binary_with_run_system():
 
 run_example_binary_with_run_system()
 
+def run_example_custom_logging_autogenerated():
+    """
+    This is an example function for the autogeneration of logging codes that binary_c uses.
+    """
+
+    # generate logging lines
+    logging_line = autogen_C_logging_code(
+        {
+            "MY_STELLAR_DATA": ["model.time", "star[0].mass"],
+            "my_sss2": ["model.time", "star[1].mass"],
+        }
+    )
+
+
+    # Generate code around logging lines
+    custom_logging_code = binary_c_log_code(logging_line)
+
+    # Generate library and get memaddr
+    func_memaddr = create_and_load_logging_function(custom_logging_code)
+
+    #
+    m1 = 15.0  # Msun
+    m2 = 14.0  # Msun
+    separation = 0  # 0 = ignored, use period
+    orbital_period = 4530.0  # days
+    eccentricity = 0.0
+    metallicity = 0.02
+    max_evolution_time = 15000
+    argstring = "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}".format(
+        m1, m2, separation, orbital_period, eccentricity, metallicity, max_evolution_time
+    )
+    output = binary_c_python_api.run_binary_custom_logging(argstring, func_memaddr)
+    print(output)
+
+run_example_custom_logging_autogenerated()
+
 
 def run_example_binary_with_custom_logging():
     """
diff --git a/examples/examples_custom_logging.py b/examples/examples_custom_logging.py
index b7e267e5b..a6c93ab7c 100644
--- a/examples/examples_custom_logging.py
+++ b/examples/examples_custom_logging.py
@@ -8,15 +8,20 @@ from binarycpython.utils.custom_logging_functions import (
 
 from binarycpython.utils.grid import Population
 
+#################################################
+# 
+
+
+
+#################################################
 # no logging set.
 pop = Population()
 pop.set(M_1=10, M_2=10, separation=0, orbital_period=4530, eccentricity=0, metallicity=0.02, max_evolution_time=15000)
 out = pop.evolve_single()
 print(out)
 
-
-
-###########################################
+#################################################
+# Example logging snippet for logging 
 pop.set(C_logging_code="""
     if(stardata->star[0].stellar_type>=MS)
     {
@@ -47,6 +52,7 @@ print(out)
 
 
 #################################################
+# Example logging snippet for checking whether the system becomes a NS, and stop the evolution if so.
 pop.set(M_1=100, M_2=10, separation=0, orbital_period=400530, eccentricity=0, metallicity=0.002, max_evolution_time=15000)
 pop.set(C_logging_code="""
     if(stardata->star[0].stellar_type>=NS)
@@ -72,52 +78,10 @@ pop.set(C_logging_code="""
     };
 """) 
 out = pop.evolve_single()
-print(out)
-
-
 
 
+# TODO: add function that shows a 
 
+# TODO: add function for compact object mergers
 
-
-
-
-
-
-quit()
-
-
-
-def custom_logging_autogenerated():
-    """
-    This is an example function for the autogeneration of logging codes that binary_c uses.
-    """
-
-    # generate logging lines
-    logging_line = autogen_C_logging_code(
-        {
-            "MY_STELLAR_DATA": ["model.time", "star[0].mass"],
-            "my_sss2": ["model.time", "star[1].mass"],
-        }
-    )
-
-
-    # Generate code around logging lines
-    custom_logging_code = binary_c_log_code(logging_line)
-
-    # Generate library and get memaddr
-    func_memaddr = create_and_load_logging_function(custom_logging_code)
-
-    #
-    m1 = 15.0  # Msun
-    m2 = 14.0  # Msun
-    separation = 0  # 0 = ignored, use period
-    orbital_period = 4530.0  # days
-    eccentricity = 0.0
-    metallicity = 0.02
-    max_evolution_time = 15000
-    argstring = "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}".format(
-        m1, m2, separation, orbital_period, eccentricity, metallicity, max_evolution_time
-    )
-    output = binary_c_python_api.run_binary_custom_logging(argstring, func_memaddr)
-    print(output)
\ No newline at end of file
+# TODO: add function 
\ No newline at end of file
-- 
GitLab