diff --git a/.github/workflows/compas-compile-ci.yml b/.github/workflows/compas-compile-ci.yml index 4a31a801b..2459bbe91 100644 --- a/.github/workflows/compas-compile-ci.yml +++ b/.github/workflows/compas-compile-ci.yml @@ -15,8 +15,9 @@ name: COMPAS compile test jobs: compas: env: - ARTIFACT_NAME: detailedEvolutionPlot.eps + ARTIFACT_NAME: detailedEvolutionPlot.png ARTIFACT_PATH: py_tests/test_artifacts + name: Build COMPAS runs-on: '${{ matrix.os}}' container: '${{matrix.container}}' @@ -49,8 +50,8 @@ jobs: pip install -e .[dev] - name: Run example COMPAS job run: | - export COMPAS_ROOT_DIR=${GITHUB_WORKSPACE} - cd ${GITHUB_WORKSPACE}/misc/examples/methods_paper_plots/detailed_evolution + export COMPAS_EXECUTABLE_PATH=${GITHUB_WORKSPACE}/src/COMPAS + cd ${GITHUB_WORKSPACE}/py_tests/test_data/ chmod 755 run.sh cat run.sh ./run.sh diff --git a/compas_python_utils/detailed_evolution_plotter/plot_detailed_evolution.py b/compas_python_utils/detailed_evolution_plotter/plot_detailed_evolution.py index 6d8d34668..f7479b796 100644 --- a/compas_python_utils/detailed_evolution_plotter/plot_detailed_evolution.py +++ b/compas_python_utils/detailed_evolution_plotter/plot_detailed_evolution.py @@ -4,7 +4,7 @@ # # ################################################################### -import os, sys +import os import shutil import numpy as np import h5py as h5 @@ -12,9 +12,9 @@ from matplotlib import rcParams import argparse import tempfile +from pathlib import Path -HERE = os.path.dirname(os.path.realpath(__file__)) -VAN_DEN_HEUVEL_DIR = os.path.join(HERE, '/van_den_heuvel_figures/') +IMG_DIR = Path(__file__).parent / "van_den_heuvel_figures" @@ -582,7 +582,7 @@ def getEventImage(self, image_num, rotate_image): on the stellar types, to get the van den Heuvel diagrams. """ - self.imgFile = os.path.join(VAN_DEN_HEUVEL_DIR, f'{image_num}.png') + self.imgFile = os.path.join(IMG_DIR, f'{image_num}.png') img = plt.imread(self.imgFile) # import image if rotate_image: img = img[:, ::-1, :] # flip across y-axis diff --git a/examples/methods_paper_plots/detailed_evolution/Grid_demo.txt b/examples/methods_paper_plots/detailed_evolution/Grid_demo.txt deleted file mode 100644 index c155ff9a2..000000000 --- a/examples/methods_paper_plots/detailed_evolution/Grid_demo.txt +++ /dev/null @@ -1,3 +0,0 @@ ---initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.000000e+00 --semi-major-axis 3.5 --kick-magnitude-1 0 --kick-magnitude-2 0 ---initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.000000e+00 --semi-major-axis 3.5 --kick-magnitude-1 0 --kick-magnitude-2 0 - diff --git a/examples/methods_paper_plots/detailed_evolution/example_bbh_compas_config.yaml b/examples/methods_paper_plots/detailed_evolution/example_bbh_compas_config.yaml deleted file mode 100644 index 623bc7fb6..000000000 --- a/examples/methods_paper_plots/detailed_evolution/example_bbh_compas_config.yaml +++ /dev/null @@ -1,273 +0,0 @@ -##~!!~## COMPAS option values -##~!!~## File Created Tue Oct 31 10:11:32 2023 by COMPAS v02.40.00 -##~!!~## -##~!!~## The default COMPAS YAML file (``compasConfigDefault.yaml``), as distributed, has -##~!!~## all COMPAS option entries commented so that the COMPAS default value for the -##~!!~## option is used by default. To use a value other than the COMPAS default value, -##~!!~## users must uncomment the entry and change the option value to the desired value. - -booleanChoices: - - ### LOGISTICS -# --debug-to-file: False # Default: False - --detailed-output: True # Default: False # WARNING! this creates a data heavy file -# --enable-warnings: False # Default: False # option to enable/disable warning messages -# --errors-to-file: False # Default: False -# --evolve-unbound-systems: True # Default: True -# --population-data-printing: False # Default: False -# --print-bool-as-string: False # Default: False -# --quiet: False # Default: False -# --rlof-printing: True # Default: True -# --store-input-files: True # Default: True -# --switch-log: False # Default: False - - ### STELLAR PROPERTIES -# --check-photon-tiring-limit: False # Default: False -# --use-mass-loss: True # Default: True -# --expel-convective-envelope-above-luminosity-threshold: False # Default: False - - ### BINARY PROPERTIES -# --allow-touching-at-birth: False # Default: False # record binaries that have stars touching at birth in output files - - ### MASS TRANSFER -# --angular-momentum-conservation-during-circularisation: False # Default: False -# --allow-rlof-at-birth: True # Default: True # allow binaries that have one or both stars in RLOF at birth to evolve, particularly useful in the context of CHE binaries -# --circularise-binary-during-mass-transfer: True # Default: True -# --hmxr-binaries: False # Default: False -# --mass-transfer: True # Default: True -# --retain-core-mass-during-caseA-mass-transfer: True # Default: True - - ### COMMON ENVELOPE -# --common-envelope-allow-immediate-RLOF-post-CE-survive: False # Default: False -# --common-envelope-allow-main-sequence-survive: True # Default: True # Allow main sequence stars to survive CE -# --common-envelope-allow-radiative-envelope-survive: False # Default: False -# --common-envelope-lambda-nanjing-enhanced: False # Default: False -# --common-envelope-lambda-nanjing-interpolate-in-mass: False # Default: False -# --common-envelope-lambda-nanjing-interpolate-in-metallicity: False # Default: False -# --common-envelope-lambda-nanjing-use-rejuvenated-mass: False # Default: False -# --revised-energy-formalism-nandez-ivanova: False # Default: False - - ### TIDES -# --enable-tides: False # Default: False - - ### SUPERNOVAE, KICKS AND REMNANTS -# --allow-non-stripped-ECSN: False # Default: False -# --pair-instability-supernovae: True # Default: True -# --pulsational-pair-instability: True # Default: True - - ### PULSAR PARAMETERS -# --evolve-pulsars: False # Default: False - - ### WHITE DWARF PARAMETERS -# --evolve-double-white-dwarfs: False # Default: False - - -numericalChoices: - - ### LOGISTICS -# --debug-level: 0 # Default: 0 -# --logfile-common-envelopes-record-types: -1 # Default: -1 -# --logfile-detailed-output-record-types: -1 # Default: -1 -# --logfile-double-compact-objects-record-types: -1 # Default: -1 -# --logfile-pulsar-evolution-record-types: -1 # Default: -1 -# --logfile-rlof-parameters-record-types: -1 # Default: -1 -# --logfile-supernovae-record-types: -1 # Default: -1 -# --logfile-system-parameters-record-types: -1 # Default: -1 -# --grid-lines-to-process: 9223372036854775807 # Default: 9223372036854775807 -# --grid-start-line: 0 # Default: 0 -# --hdf5-chunk-size: 100000 # Default: 100000 -# --hdf5-buffer-size: 1 # Default: 1 -# --log-level: 0 # Default: 0 -# --maximum-evolution-time: 13700.00 # Default: 13700.00 # maximum physical time a system can be evolved [Myr] -# --maximum-number-timestep-iterations: 99999 # Default: 99999 -# --number-of-systems: 10 # Default: 10 # number of systems per batch -# --timestep-multiplier: 1.000000 # Default: 1.000000 # optional multiplier relative to default time step duration - - ### STELLAR PROPERTIES -# --cool-wind-mass-loss-multiplier: 1.000000 # Default: 1.000000 -# --initial-mass: 5.000000 # Default: 5.000000 # initial mass for SSE -# --initial-mass-min: 5.000000 # Default: 5.000000 # use 5.0 for DCOs [Msol] -# --initial-mass-max: 150.00 # Default: 150.00 # stellar tracks extrapolated above 50 Msol (Hurley+2000) [Msol] -# --initial-mass-power: 0.000000 # Default: 0.000000 -# --luminosity-to-mass-threshold: 4.200000 # Default: 4.200000 -# --metallicity: 0.014200 # Default: 0.014200 # metallicity for both SSE and BSE - Solar metallicity Asplund+2010 -# --metallicity-min: 0.000100 # Default: 0.000100 -# --metallicity-max: 0.030000 # Default: 0.030000 -# --luminous-blue-variable-multiplier: 1.500000 # Default: 1.500000 -# --overall-wind-mass-loss-multiplier: 1.000000 # Default: 1.000000 -# --random-seed: 0 # Default: 0 -# --rotational-frequency: 0.000000 # Default: 0.000000 -# --rotational-frequency-1: 0.000000 # Default: 0.000000 -# --rotational-frequency-2: 0.000000 # Default: 0.000000 -# --wolf-rayet-multiplier: 0.100000 # Default: 0.100000 - - ### BINARY PROPERTIES -# --eccentricity: 0.000000 # Default: 0.000000 # eccentricity for BSE -# --eccentricity-min: 0.000000 # Default: 0.000000 -# --eccentricity-max: 1.000000 # Default: 1.000000 -# --initial-mass-1: 5.000000 # Default: 5.000000 # primary initial mass for BSE -# --initial-mass-2: 5.000000 # Default: 5.000000 # secondary initial mass for BSE -# --mass-ratio: 1.000000 # Default: 1.000000 -# --mass-ratio-min: 0.010000 # Default: 0.010000 -# --mass-ratio-max: 1.000000 # Default: 1.000000 -# --minimum-secondary-mass: 0.100000 # Default: 0.100000 # Brown dwarf limit [Msol] -# --orbital-period: 0.100000 # Default: 0.100000 # orbital period for BSE -# --orbital-period-min: 1.100000 # Default: 1.100000 # [days] -# --orbital-period-max: 1000.00 # Default: 1000.00 # [days] -# --semi-major-axis: 0.100000 # Default: 0.100000 # semi-major axis for BSE -# --semi-major-axis-min: 0.010000 # Default: 0.010000 # [AU] -# --semi-major-axis-max: 1000.00 # Default: 1000.00 # [AU] - - ### MASS TRANSFER -# --convective-envelope-temperature-threshold: 5370.00 # Default: 5370.00 # Only if using envelope-state-prescription = 'FIXED_TEMPERATURE' -# --critical-mass-ratio-HG-degenerate-accretor: 0.210000 # Default: 0.210000 -# --critical-mass-ratio-HG-non-degenerate-accretor: 0.250000 # Default: 0.250000 -# --critical-mass-ratio-MS-high-mass-degenerate-accretor: 0.000000 # Default: 0.000000 -# --critical-mass-ratio-MS-high-mass-non-degenerate-accretor: 0.625000 # Default: 0.625000 -# --critical-mass-ratio-MS-low-mass-degenerate-accretor: 1.000000 # Default: 1.000000 -# --critical-mass-ratio-MS-low-mass-non-degenerate-accretor: 1.440000 # Default: 1.440000 -# --critical-mass-ratio-giant-degenerate-accretor: 0.870000 # Default: 0.870000 -# --critical-mass-ratio-giant-non-degenerate-accretor: -1.000000 # Default: -1.000000 -# --critical-mass-ratio-helium-HG-degenerate-accretor: 0.210000 # Default: 0.210000 -# --critical-mass-ratio-helium-HG-non-degenerate-accretor: 0.250000 # Default: 0.250000 -# --critical-mass-ratio-helium-MS-degenerate-accretor: 0.000000 # Default: 0.000000 -# --critical-mass-ratio-helium-giant-degenerate-accretor: 0.870000 # Default: 0.870000 -# --critical-mass-ratio-helium-MS-non-degenerate-accretor: 0.000000 # Default: 0.000000 -# --critical-mass-ratio-helium-giant-non-degenerate-accretor: 1.280000 # Default: 1.280000 -# --critical-mass-ratio-white-dwarf-degenerate-accretor: 1.600000 # Default: 1.600000 -# --critical-mass-ratio-white-dwarf-non-degenerate-accretor: 0.000000 # Default: 0.000000 -# --mass-transfer-fa: 0.500000 # Default: 0.500000 # Only if using mass-transfer-accretion-efficiency-prescription = 'FIXED' -# --mass-transfer-jloss: 1.000000 # Default: 1.000000 # Only if using mass-transfer-angular-momentum-loss-prescription = 'FIXED' -# --mass-transfer-jloss-macleod-linear-fraction: 0.500000 # Default: 0.500000 -# --mass-transfer-thermal-limit-C: 10.000000 # Default: 10.000000 -# --zeta-adiabatic-arbitrary: 10000.00 # Default: 10000.00 -# --zeta-main-sequence: 2.000000 # Default: 2.000000 -# --zeta-radiative-envelope-giant: 6.500000 # Default: 6.500000 - - ### COMMON ENVELOPE -# --common-envelope-alpha: 1.000000 # Default: 1.000000 -# --common-envelope-alpha-thermal: 1.000000 # Default: 1.000000 # lambda = alpha_th*lambda_b + (1-alpha_th)*lambda_g -# --common-envelope-lambda: 0.100000 # Default: 0.100000 # Only if using 'LAMBDA_FIXED' -# --common-envelope-lambda-multiplier: 1.000000 # Default: 1.000000 # Multiply common envelope lambda by some constant -# --common-envelope-mass-accretion-constant: 0.000000 # Default: 0.000000 -# --common-envelope-mass-accretion-max: 0.100000 # Default: 0.100000 # For 'MACLEOD+2014' [Msol] -# --common-envelope-mass-accretion-min: 0.040000 # Default: 0.040000 # For 'MACLEOD+2014' [Msol] -# --common-envelope-recombination-energy-density: 15000000000000.00 # Default: 15000000000000.00 -# --common-envelope-slope-kruckow: -0.833333 # Default: -0.833333 -# --maximum-mass-donor-nandez-ivanova: 2.000000 # Default: 2.000000 - - ### SUPERNOVAE, KICKS AND REMNANTS -# --eddington-accretion-factor: 1.000000 # Default: 1.000000 # multiplication Factor for eddington accretion onto NS&BH -# --fix-dimensionless-kick-magnitude: -1.000000 # Default: -1.000000 -# --fryer-22-fmix: 0.500000 # Default: 0.500000 # parameter describing mixing growth time when using the 'FRYER2022' remnant mass prescription -# --fryer-22-mcrit: 5.750000 # Default: 5.750000 # critical mass for BH formation when using the 'FRYER2022' remnant mass prescription -# --kick-direction-power: 0.000000 # Default: 0.000000 -# --kick-magnitude-sigma-CCSN-NS: 265.00 # Default: 265.00 # [km/s] -# --kick-magnitude-sigma-CCSN-BH: 265.00 # Default: 265.00 # [km/s] -# --kick-magnitude-max: -1.000000 # Default: -1.000000 -# --kick-magnitude-random: 0.000000 # Default: 0.000000 # (SSE) used to draw the kick magnitude for the star should it undergo a supernova event -# --kick-magnitude: 0.000000 # Default: 0.000000 # (SSE) (drawn) kick magnitude for the star should it undergo a supernova event [km/s] -# --kick-magnitude-random-1: 0.000000 # Default: 0.000000 # (BSE) used to draw the kick magnitude for the primary star should it undergo a supernova event -# --kick-magnitude-1: 0.000000 # Default: 0.000000 # (BSE) (drawn) kick magnitude for the primary star should it undergo a supernova event [km/s] -# --kick-theta-1: 0.000000 # Default: 0.000000 # (BSE) angle between the orbital plane and the 'z' axis of the supernova vector for the primary star should it undergo a supernova event [radians] -# --kick-phi-1: 0.000000 # Default: 0.000000 # (BSE) angle between 'x' and 'y', both in the orbital plane of the supernova vector, for the primary star should it undergo a supernova event [radians] -# --kick-mean-anomaly-1: 0.000000 # Default: 0.000000 # (BSE) mean anomaly at the instant of the supernova for the primary star should it undergo a supernova event - should be uniform in [0, 2pi) [radians] -# --kick-magnitude-random-2: 0.000000 # Default: 0.000000 # (BSE) used to draw the kick velocity for the secondary star should it undergo a supernova event -# --kick-magnitude-2: 0.000000 # Default: 0.000000 # (BSE) (drawn) kick magnitude for the secondary star should it undergo a supernova event [km/s] -# --kick-theta-2: 0.000000 # Default: 0.000000 # (BSE) angle between the orbital plane and the 'z' axis of the supernova vector for the secondary star should it undergo a supernova event [radians] -# --kick-phi-2: 0.000000 # Default: 0.000000 # (BSE) angle between 'x' and 'y', both in the orbital plane of the supernova vector, for the secondary star should it undergo a supernova event [radians] -# --kick-mean-anomaly-2: 0.000000 # Default: 0.000000 # (BSE) mean anomaly at the instant of the supernova for the secondary star should it undergo a supernova event - should be uniform in [0, 2pi) [radians] -# --kick-magnitude-sigma-ECSN: 30.000000 # Default: 30.000000 # [km/s] -# --kick-magnitude-sigma-USSN: 30.000000 # Default: 30.000000 # [km/s] -# --kick-scaling-factor: 1.000000 # Default: 1.000000 -# --maximum-neutron-star-mass: 2.500000 # Default: 2.500000 -# --mcbur1: 1.600000 # Default: 1.600000 -# --muller-mandel-kick-multiplier-BH: 200.00 # Default: 200.00 # scaling prefactor for BH kicks when using the 'MULLERMANDEL' kick magnitude distribution -# --muller-mandel-kick-multiplier-NS: 520.00 # Default: 520.00 # scaling prefactor for NS kicks when using the 'MULLERMANDEL' kick magnitude distribution -# --muller-mandel-sigma-kick: 0.300000 # Default: 0.300000 # kick scatter when using the 'MULLERMANDEL' kick magnitude distribution -# --neutrino-mass-loss-BH-formation-value: 0.100000 # Default: 0.100000 -# --pisn-lower-limit: 60.000000 # Default: 60.000000 # Minimum core mass for PISN [Msol] -# --pisn-upper-limit: 135.00 # Default: 135.00 # Maximum core mass for PISN [Msol] -# --ppi-lower-limit: 35.000000 # Default: 35.000000 # Minimum core mass for PPI [Msol] -# --ppi-upper-limit: 60.000000 # Default: 60.000000 # Maximum core mass for PPI [Msol] - - ### PULSAR PARAMETERS -# --pulsar-birth-magnetic-field-distribution-min: 11.000000 # Default: 11.000000 # [log10(B/G)] -# --pulsar-birth-magnetic-field-distribution-max: 13.000000 # Default: 13.000000 # [log10(B/G)] -# --pulsar-birth-spin-period-distribution-min: 10.000000 # Default: 10.000000 # [ms] -# --pulsar-birth-spin-period-distribution-max: 100.00 # Default: 100.00 # [ms] -# --pulsar-magnetic-field-decay-timescale: 1000.00 # Default: 1000.00 # [Myr] -# --pulsar-magnetic-field-decay-massscale: 0.025000 # Default: 0.025000 # [Msol] -# --pulsar-minimum-magnetic-field: 8.000000 # Default: 8.000000 # [log10(B/G)] - - -stringChoices: - - ### LOGISTICS -# --add-options-to-sysparms: 'GRID' # Default: 'GRID' # Options: ['NEVER','GRID','ALWAYS'] - --grid: 'Grid_demo.txt' # Default: '' # grid file name (e.g. 'mygrid.txt') -# --mode: 'BSE' # Default: 'BSE' # Options: ['BSE','SSE'] # evolving single (SSE) or binary stars (BSE) -# --notes: { } # Default: { } -# --notes-hdrs: { } # Default: { } -# --output-container: 'COMPAS_Output' # Default: 'COMPAS_Output' - - ### STELLAR PROPERTIES -# --chemically-homogeneous-evolution: 'PESSIMISTIC' # Default: 'PESSIMISTIC' # Options: ['PESSIMISTIC','OPTIMISTIC','NONE'] # chemically homogeneous evolution -# --envelope-state-prescription: 'LEGACY' # Default: 'LEGACY' # Options: ['FIXED_TEMPERATURE','HURLEY','LEGACY'] -# --initial-mass-function: 'KROUPA' # Default: 'KROUPA' # Options: ['KROUPA','UNIFORM','POWERLAW','SALPETER'] -# --luminous-blue-variable-prescription: 'HURLEY_ADD' # Default: 'HURLEY_ADD' # Options: ['BELCZYNSKI','HURLEY','HURLEY_ADD','NONE'] -# --mass-loss-prescription: 'VINK' # Default: 'VINK' # Options: ['VINK','HURLEY','NONE'] -# --metallicity-distribution: 'ZSOLAR' # Default: 'ZSOLAR' # Options: ['LOGUNIFORM','ZSOLAR'] -# --pulsational-pair-instability-prescription: 'MARCHANT' # Default: 'MARCHANT' # Options: ['FARMER','MARCHANT','STARTRACK','COMPAS'] - - ### BINARY PROPERTIES -# --eccentricity-distribution: 'ZERO' # Default: 'ZERO' # Options: ['SANA2012','DUQUENNOYMAYOR1991','GELLER+2013','THERMAL','FLAT','ZERO'] -# --mass-ratio-distribution: 'FLAT' # Default: 'FLAT' # Options: ['SANA2012','DUQUENNOYMAYOR1991','FLAT'] -# --orbital-period-distribution: 'FLATINLOG' # Default: 'FLATINLOG' # Options: ['FLATINLOG'] -# --rotational-velocity-distribution: 'ZERO' # Default: 'ZERO' # Options: ['VLTFLAMES','HURLEY','ZERO'] -# --semi-major-axis-distribution: 'FLATINLOG' # Default: 'FLATINLOG' # Options: ['SANA2012','DUQUENNOYMAYOR1991','FLATINLOG'] - - ### MASS TRANSFER -# --case-BB-stability-prescription: 'ALWAYS_STABLE' # Default: 'ALWAYS_STABLE' # Options: ['ALWAYS_UNSTABLE','TREAT_AS_OTHER_MT','ALWAYS_STABLE_ONTO_NSBH','ALWAYS_STABLE'] -# --critical-mass-ratio-prescription: 'NONE' # Default: 'NONE' # Options: ['HURLEY_HJELLMING_WEBBINK','GE20_IC','GE20','CLAEYS','NONE'] -# --stellar-zeta-prescription: 'SOBERMAN' # Default: 'SOBERMAN' # Options: ['NONE','ARBITRARY','HURLEY','SOBERMAN'] -# --mass-transfer-angular-momentum-loss-prescription: 'ISOTROPIC' # Default: 'ISOTROPIC' # Options: ['ARBITRARY','MACLEOD_LINEAR','CIRCUMBINARY','ISOTROPIC','JEANS'] -# --mass-transfer-accretion-efficiency-prescription: 'THERMAL' # Default: 'THERMAL' # Options: ['FIXED','THERMAL'] -# --mass-transfer-rejuvenation-prescription: 'STARTRACK' # Default: 'STARTRACK' # Options: ['STARTRACK','NONE'] -# --mass-transfer-thermal-limit-accretor: 'CFACTOR' # Default: 'CFACTOR' # Options: ['ROCHELOBE','CFACTOR'] - - ### COMMON ENVELOPE -# --common-envelope-formalism: 'ENERGY' # Default: 'ENERGY' # Options: ['TWO_STAGE','ENERGY'] -# --common-envelope-lambda-prescription: 'LAMBDA_NANJING' # Default: 'LAMBDA_NANJING' # Options: ['LAMBDA_DEWI','LAMBDA_KRUCKOW','LAMBDA_NANJING','LAMBDA_LOVERIDGE','LAMBDA_FIXED'] # Xu & Li 2010 -# --common-envelope-mass-accretion-prescription: 'ZERO' # Default: 'ZERO' # Options: ['CHEVALIER','MACLEOD','UNIFORM','CONSTANT','ZERO'] - - ### SUPERNOVAE, KICKS AND REMNANTS -# --black-hole-kicks: 'FALLBACK' # Default: 'FALLBACK' # Options: ['FALLBACK','ZERO','REDUCED','FULL'] -# --fryer-supernova-engine: 'DELAYED' # Default: 'DELAYED' # Options: ['DELAYED','RAPID'] -# --kick-magnitude-distribution: 'MULLERMANDEL' # Default: 'MULLERMANDEL' # Options: ['MULLERMANDEL','MULLER2016MAXWELLIAN','MULLER2016','BRAYELDRIDGE','MAXWELLIAN','FLAT','FIXED','ZERO'] -# --kick-direction: 'ISOTROPIC' # Default: 'ISOTROPIC' # Options: ['POLES','WEDGE','POWERLAW','PERPENDICULAR','INPLANE','ISOTROPIC'] -# --neutron-star-equation-of-state: 'SSE' # Default: 'SSE' # Options: ['ARP3','SSE'] -# --neutrino-mass-loss-BH-formation: 'FIXED_MASS' # Default: 'FIXED_MASS' # Options: ['FIXED_MASS','FIXED_FRACTION'] -# --pulsar-birth-magnetic-field-distribution: 'ZERO' # Default: 'ZERO' # Options: ['LOGNORMAL','UNIFORM','FLATINLOG','FIXED','ZERO'] -# --pulsar-birth-spin-period-distribution: 'ZERO' # Default: 'ZERO' # Options: ['NORMAL','UNIFORM','FIXED','ZERO'] -# --remnant-mass-prescription: 'MULLERMANDEL' # Default: 'MULLERMANDEL' # Options: ['SCHNEIDER2020ALT','SCHNEIDER2020','MULLERMANDEL','MULLER2016','FRYER2022','FRYER2012','BELCZYNSKI2002','HURLEY2000'] - - ### LOGFILES AND OUTPUTS -# --logfile-type: 'HDF5' # Default: 'HDF5' # Options: ['TXT','TSV','CSV','HDF5','NONE'] -# --logfile-name-prefix: '' # Default: '' -# --logfile-definitions: '' # Default: '' -# --logfile-common-envelopes: 'BSE_Common_Envelopes' # Default: 'BSE_Common_Envelopes' -# --logfile-detailed-output: 'BSE_Detailed_Output' # Default: 'BSE_Detailed_Output' -# --logfile-double-compact-objects: 'BSE_Double_Compact_Objects' # Default: 'BSE_Double_Compact_Objects' -# --logfile-pulsar-evolution: 'BSE_Pulsar_Evolution' # Default: 'BSE_Pulsar_Evolution' -# --logfile-rlof-parameters: 'BSE_RLOF' # Default: 'BSE_RLOF' -# --logfile-supernovae: 'BSE_Supernovae' # Default: 'BSE_Supernovae' -# --logfile-switch-log: 'BSE_Switch_Log' # Default: 'BSE_Switch_Log' -# --logfile-system-parameters: 'BSE_System_Parameters' # Default: 'BSE_System_Parameters' -# --output-path: '.' # Default: '.' - - -listChoices: - -# --log-classes: { } # Default: { } -# --debug-classes: { } # Default: { } diff --git a/py_tests/conftest.py b/py_tests/conftest.py index ef25aea6d..53053e2ed 100644 --- a/py_tests/conftest.py +++ b/py_tests/conftest.py @@ -9,7 +9,7 @@ HERE = os.path.dirname(__file__) TEST_CONFIG_DIR = os.path.join(HERE, "test_data") -TEST_GRID = os.path.join(TEST_CONFIG_DIR, "grid.txt") +TEST_BASH = os.path.join(TEST_CONFIG_DIR, "run.sh") TEST_ARCHIVE_DIR = os.path.join(HERE, "test_artifacts") REPO_ROOT = os.getenv("COMPAS_ROOT_DIR", os.path.abspath(os.path.join(HERE, ".."))) COMPAS_EXE = os.path.join(REPO_ROOT, "src", "COMPAS") @@ -27,10 +27,8 @@ def example_compas_output_path(clean=False): if not os.path.exists(compas_data_path) or clean: # Check if path exists curr_dir = os.getcwd() os.chdir(TEST_CONFIG_DIR) - cmd = f"{COMPAS_EXE} --detailed-output --grid {TEST_GRID}" # run the command in shell "compas_run_submit {TEST_CONFIG_FNAME}" with subprocess - subprocess.run(cmd, shell=True, check=True) - + subprocess.run(TEST_BASH, shell=True, check=True) os.chdir(curr_dir) print("Generated COMPAS test data") diff --git a/py_tests/test_data/grid.txt b/py_tests/test_data/grid.txt deleted file mode 100644 index 9715fd491..000000000 --- a/py_tests/test_data/grid.txt +++ /dev/null @@ -1,2 +0,0 @@ ---initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.0 --semi-major-axis 3.5 --kick-magnitude-1 0.0 --kick-magnitude-2 0.0 ---initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.0 --semi-major-axis 3.5 --kick-magnitude-1 0.0 --kick-magnitude-2 0.0 diff --git a/py_tests/test_data/run.sh b/py_tests/test_data/run.sh new file mode 100644 index 000000000..2ef9f6415 --- /dev/null +++ b/py_tests/test_data/run.sh @@ -0,0 +1,19 @@ +#bin/bash +echo ">>> GENERATING TEST COMPAS DATA <<<" +# if $COMPAS_EXECUTABLE_PATH not set, set to ../../src/COMPAS +COMPAS_EXECUTABLE_PATH=${COMPAS_EXECUTABLE_PATH:-../../src/COMPAS} +$COMPAS_EXECUTABLE_PATH \ + -n 2 \ + --initial-mass-1 35 \ + --initial-mass-2 31 \ + -a 3.5 \ + --random-seed 0 \ + --metallicity 0.001 \ + --detailed-output \ + > compas_run.log +cat compas_run.log +echo "Generating detailed evolution plot" +compas_plot_detailed_evolution "./COMPAS_Output/Detailed_Output/BSE_Detailed_Output_0.h5" --dont-show >> detailed_evolution.log +echo "Out files:" +ls -l +echo ">>> DONE <<<" diff --git a/py_tests/test_plot_detailed_evolution.py b/py_tests/test_plot_detailed_evolution.py index a287cde91..4d8c0f078 100644 --- a/py_tests/test_plot_detailed_evolution.py +++ b/py_tests/test_plot_detailed_evolution.py @@ -20,7 +20,7 @@ def test_plotter(example_compas_output_path, capsys, test_archive_dir): assert runtime < 30 assert os.path.exists(os.path.join(test_archive_dir, "vanDenHeuvelPlot.eps")) - assert os.path.exists(os.path.join(test_archive_dir, "detailedEvolutionPlot.eps")) + assert os.path.exists(os.path.join(test_archive_dir, "detailedEvolutionPlot.png")) with open(os.path.join(test_archive_dir, "test_plotter.log"), "w") as f: f.write(sout)