Skip to content

Commit

Permalink
Merge pull request #67 from biosimulators/change-log-level
Browse files Browse the repository at this point in the history
Implemented try logic and instantiated global `STDOUT_LEVEL`  log level of Capturer Object as per #56 and refactored order of operations as per #66.
  • Loading branch information
AlexPatrie authored May 8, 2023
2 parents a18afb6 + 68a807d commit e446a40
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions biosimulators_copasi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,20 @@
import numpy
import os
import tempfile
import platform


__all__ = ['exec_sedml_docs_in_combine_archive', 'exec_sed_doc', 'exec_sed_task', 'preprocess_sed_task']


CURRENT_PLATFORM = platform.system()
try:
assert CURRENT_PLATFORM == "Darwin"
DEFAULT_STDOUT_LEVEL = StandardOutputErrorCapturerLevel.python
except AssertionError as e:
DEFAULT_STDOUT_LEVEL = StandardOutputErrorCapturerLevel.c


def exec_sedml_docs_in_combine_archive(archive_filename: str, out_dir: str, config: Optional[Config] = None,
fix_copasi_generated_combine_archive: Optional[bool] = None) -> Tuple[SedDocumentResults, CombineArchiveLog]:
""" Execute the SED tasks defined in a COMBINE/OMEX archive and save the outputs
Expand Down Expand Up @@ -79,7 +89,7 @@ def exec_sedml_docs_in_combine_archive(archive_filename: str, out_dir: str, conf
def exec_sed_doc(doc: Union[SedDocument, str], working_dir: str, base_out_path: str, rel_out_path: Optional[str] = None,
apply_xml_model_changes: bool = True, log: Optional[SedDocumentLog] = None,
indent: int = 0, pretty_print_modified_xml_models: bool = False,
log_level: Optional[Union[StandardOutputErrorCapturerLevel, str]] = StandardOutputErrorCapturerLevel.c,
log_level: Optional[StandardOutputErrorCapturerLevel]=DEFAULT_STDOUT_LEVEL,
config: Optional[Config] = None) -> Tuple[ReportResults, SedDocumentLog]:
""" Execute the tasks specified in a SED document and generate the specified outputs
Expand Down Expand Up @@ -190,8 +200,10 @@ def exec_sed_task(task: Task, variables: List[Variable], preprocessed_task: Opti
else: # noqa python:S3776
step_number = (
sim.number_of_points
* (sim.output_end_time - sim.initial_time)
/ (sim.output_end_time - sim.output_start_time)
* (
(sim.output_end_time - sim.initial_time)
/ (sim.output_end_time - sim.output_start_time)
)
)
if step_number != math.floor(step_number):
raise NotImplementedError('Time course must specify an integer number of time points')
Expand Down

0 comments on commit e446a40

Please sign in to comment.