Skip to content

isolated evolution step #35

Merged
ezapartas merged 94 commits intodevelopmentfrom
manos_implementing_isolated_evolution_step
May 18, 2023
Merged

isolated evolution step #35
ezapartas merged 94 commits intodevelopmentfrom
manos_implementing_isolated_evolution_step

Conversation

@ezapartas
Copy link
Copy Markdown
Contributor

New step to have evolution of isolated single stars (i.e. initially single stars, disrupted companions and mergers) based on detached step

@ezapartas ezapartas changed the title isolated evolution step isolated evolution step <DO NOT MERGE YET> Feb 20, 2023
@astroJeff astroJeff marked this pull request as draft May 4, 2023 14:48
Comment thread posydon/binary_evol/DT/step_detached.py Outdated
get_track_val(MESA_label, htrack, *x))
posydon_value = scale_of_that_MESA_label.transform(
posydon_attr)
if MESA_label == "center_he4":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still keep the relative value for center_he4?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will comment it out

@mkruckow mkruckow removed their request for review May 11, 2023 09:50
Comment thread posydon/binary_evol/DT/step_detached.py Outdated
Comment on lines +842 to +820
or not sol.success):
if star.state in LIST_ACCEPTABLE_STATES_FOR_HeStar:
star.htrack = True
x0 = get_root0(
MESA_label, posydon_attribute, star.htrack, rs=rs)
bnds = ([m_min_H, m_max_H], [0, None])
sol = minimize(
lambda x: (
(sc_he_core_mass_He.transform(
get_track_val(MESA_label[0], htrack, *x))
- sc_he_core_mass_He.transform(
posydon_attribute[0]))
/ sc_he_core_mass_He.transform(
posydon_attribute[0])) ** 2
+ (sc_center_he4_H.transform(
get_track_val(MESA_label[1], htrack, *x))
- sc_center_he4_H.transform(
posydon_attribute[1]))
** 2 + (sc_log_R_H.transform(
get_track_val(MESA_label[2], htrack, *x))
- sc_log_R_H.transform(
posydon_attribute[2])) ** 2,
x0, method="TNC", bounds=bnds,
)
if ((self.get_track_val("mass", star.htrack, *sol.x)
- self.get_track_val(
"he_core_mass", star.htrack, *sol.x))
/ self.get_track_val(
"mass", star.htrack, *sol.x) >= 0.05):
initials = (np.nan, np.nan)

if initials is None:
if self.verbose:
print("sol.fun = ", np.abs(sol.fun))
if np.abs(sol.fun) < tolerance_mist_integration:
if self.verbose:
print("minimization in matching considered acceptable,"
" with", np.abs(sol.fun), "<",
tolerance_mist_integration, "tolerance")
initials = sol.x
star.fun = sol.fun
star.stiching_rel_mass_difference = (
self.get_track_val("mass", htrack, *sol.x) - star.mass
) / star.mass
if star.log_R in MESA_label:
star.stiching_rel_logRadius_difference = (
self.get_track_val("log_R", htrack, *sol.x)
- star.log_R) / star.log_R
else:
star.stiching_rel_logRadius_difference = np.nan
if (star.total_moment_of_inertia is not None
and not np.isnan(star.total_moment_of_inertia)):
star.stiching_rel_inertia_difference = (
self.get_track_val("inertia", htrack, *sol.x)
- star.total_moment_of_inertia
) / star.total_moment_of_inertia
elif star.state in LIST_ACCEPTABLE_STATES_FOR_postMS:
star.htrack = False
htrack = star.htrack
x0 = get_root0(
MESA_label, posydon_attribute, htrack, rs=rs)
# bnds = ([m_min_H, m_max_H], [0, None])
sol = minimize(square_difference,
x0, method="TNC", bounds=bnds)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we change the grids, we should update list_for_matching for new MESA_label, posydon_attribute, bnds as well. Just like the code above in 2nd alternative matching.

Comment on lines -1002 to -1004
if not primary.co:
m1, t1 = get_mist0(primary, primary.htrack)
m2, t2 = get_mist0(secondary, secondary.htrack)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually to update htrack if the binary goes to the 3rd alternative matching.
For the function get_star_data below, the input htrack is not updated if we call the matching function inside it.
There must be a better way to deal with the binaries where we change the htrack.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to solve it in the next commit [901590a]

@ezapartas ezapartas marked this pull request as ready for review May 18, 2023 14:37
Copy link
Copy Markdown
Contributor

@astroJeff astroJeff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this thing accepted!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not exist here. Let's remove it and then the PR should be ready to accept

@ezapartas ezapartas merged commit 4fac0c2 into development May 18, 2023
astroJeff added a commit that referenced this pull request Dec 12, 2024
* cleanup of old code not needed anymore

* Propagate documentation change from main (#31)

* Update README.md

* Update install.rst

* Update install.rst

* Prevent grid post processing from breaking (#33)

* raise warning instead of breaking post processing

* spelling mistake

* use warnigns module

* debug

* spelling

* catch other warinings and exception without braking

* prevent type error from breaking code

* fix grammar

* prevent CC2 from breakig whne gamma_center limit from star_2 is reached

* fix syntax error

* prevent the code from breaking in check_state_of_star

* fix

* Allowing for missing profiles in single grids if requested. (#36)

* Adding psygrid option for keeping tracks without profiles.

* Allowing for missing profiles in single grids.

* By default do not include stars without a final profile in a single star grid.

* Support multi metallicity for v2 datasets (#37)

* support for different metallicities

* Adding metallicity to BinaryPopulation. Forcing constant Z across grid steps.

* fix bug

* fix initial X, Y, Z

* Adding metallicity, uncomment previously broken kwargs in the ini

* Added the SyntheticPopulation class to evolve mutliple BinaryPopulations. Added MPI options to inifile.

* Add the common function to check for metallicity.

* add first step of the post processing pipeline

* bugfix

* fix bug

* debug

* bug fix

* fix bug

* fix bug

* bug fix

* fix bug

* rub test

* add step 2 of pipleline

* add logs

* rebmove break

* debug

* add plotting step to pipeline

* debug

* debug

* debug

* debug

* debug

* add post processing and train interpolators steps

* some cleaning

* cleaning

* cleaning

* cleaning

* debug

* cleaning

* clearning

* cleaning

* cleaning

* debug

* debug

* cleaning

* cleaning

* cleaning

* add support for CO-HMS and CO-HMS_RLO grids

* cleaning

* debug

* debug

* bug

* debug

* debug

* debug

* cleanig

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* add step 7 to export POSYDON pop synth dataset

* debug

* debug

* support reruns creation

* cleaning

* debug

* debug

* remove grid processing pipeline from this PR

---------

Co-authored-by: ka-rocha <kylerocha2024@u.northwestern.edu>

* Update posydon-run-grid (#44)

Correct typo: .fale. -> .false.

* Fixes in psy grid (#46)

* correct typo: profile1 -> profile2

* Fix missing composition values on grid creation

A try to check whether better defined types solve the problem.

* Debug output

* more debugging

* debug N_Z, where_to_add

* try fix

where_to_add in self.initial_values[i]

* remove debug outputs

* Fix for issue introduced in PR#36

Add "accept_missing_profile" to PROPERTIES_TO_BE_CONSISTENT

* v2 grids post-processing pipeline (#42)

* add post processing piepeline

* header

* copy the ini file togeather with the rerun points

* fix bug rerun

* automatically infer cluster name

* debug

* debug

* debug

* debug

* debug

* debug

* automatically replace zamsfilename

* add option to not start at RLO for the CO-HMS grid in case of reruns

* add all grid slices to post process

* make version an input

* debug step 2 slurm job by setting slurm_array var default to a number

* debug

* debug

* debug

* debug

* debug

* debug

* check quest setup

* debug

* debug

* debug

* debug

* parallelise step 2

* check that file exists before exporting the csv file, if they are missing print a warning and remove them from the csv file

* debug

* drop missing files is customisable for steps 2 to 7 and reruns

* debug

* debug

* debug

* debug

* increase walltime on yggdrasil because some HMS-HMS slices require more than 8 hours to process

* debug

* debug

* correct typo: profile1 -> profile2

* Fix missing composition values on grid creation

A try to check whether better defined types solve the problem.

* Debug output

* more debugging

* debug N_Z, where_to_add

* try fix

where_to_add in self.initial_values[i]

* remove debug outputs

* debug on quest

* cluster name is now an input

* include the random grids in the plotting

* debug

* Fix for issue introduced in PR#36

Add "accept_missing_profile" to PROPERTIES_TO_BE_CONSISTENT

* add ini file configuration of the processing pipeline

* add kyle's authorship

* move pipeline ini file outside bin directories to solve installation issue

* add rerun in pipeline_quest.ini

* debug opacity max rerun

---------

Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>

* Three new magnetic braking prescriptions in step_detached.py (#43)

* Update README.md

* Update install.rst

* Update install.rst

* Added three extra magnetic braking prescriptions in deffeq(), along with options to select from them, and added relevant parameters used in their calculations to this function's arguments. All calculated dOmega/dt from magnetic braking are in units of [yr-2].

* Added three extra magnetic braking prescriptions in deffeq(). Updated docstring, and conv_tau is now converted to years from sec in get_star_data

---------

Co-authored-by: Simone Bavera <32518238+ssbvr@users.noreply.github.com>

* Update setup.py

* Zepei reverse logic (#51)

* Update run-pipeline

* Plot add PISN (#50)

* Add (P)PISN to TF1

Add the new termination flags:
- 'Primary enters pair-instability regime'
- 'Secondary enters pair-instability regime'
- 'Primary enters pulsational pair-instability regime'
- 'Secondary enters pulsational pair-instability regime'

* Add (P)PISN to stable TF1

Add (P)PISN to pool of stable TF1

* Add (P)PISN to debug

Add (P)PISN to debug flag, too

* Add missing L2 flag

Add flag:
- 'overflow from L2 (R_L2) surface for q(=Macc/Mdon)>1, donor is star 2'

* Add missing L2 overflow

Add to unstable pool:
- 'overflow from L2 (R_L2) surface for q(=Macc/Mdon)>1, donor is star 2'

* add PISN commit for opacity_max fix (#59)

* Fixed more dict syntax for kwargs in docs (#53)

In SingleStar object docs

* Fixed dict syntax for kwargs1, kwargs2 definitions (#52)

* add inlist commit for hms-hms opacity max fix

* some grid fixes (#60)

* Add initial_z to be read from directory name

Add initial_z to be read from directory name, which is the case for v2 and newer versions.

* Try to get metallicity form directory name

Try to get the metallicity value from the directory name in case, there is no history file.

* Correct typo

step_7 -> step_6

* Add to reset DISPLAY for plotting 

Add to reset DISPLAY for plotting step on a cluster to avoid problems when logged in with window mode on ssh.

* Check for initial RLO in join_grids

Check for initial RLO in join_grids, too.
Use a joint initial RLO boundary.

* Debug

Flush output for debugging

* Fix bug in adding too many boundary systems

Fix bug in adding too many boundary systems

* Remove debugging

Remove debugging

* Fix list entry replacement (psygrid.py)

Fix list entry replacement in psygrid.py

* Fix list entry replacement (termination_flags.py)

Fix list entry replacement in termination_flags.py

* Add STEPID

Add the number of the step to the slurm job-name

* Update last developement changes (#62)

* Fixed more dict syntax for kwargs in docs (#53)

In SingleStar object docs

* Fixed dict syntax for kwargs1, kwargs2 definitions (#52)

---------

Co-authored-by: Camille Liotine <cliotine@u.northwestern.edu>

* account for suggestions 

- add else (nevertheless it will raise an error message later; I thought I predefined STEPID, but it looks like I put it out/or missed to put it in; using job_name here as content of the STEPID is a bad idea, because it is expected to be a single character and not a string)
- add the check for the length after the split (again, this would cause an error message later nevertheless)

* rename variable

e -> exists_already

* rename

e -> exists_already

---------

Co-authored-by: Camille Liotine <cliotine@u.northwestern.edu>

* Add slurm dependency (#64)

* Add initial_z to be read from directory name

Add initial_z to be read from directory name, which is the case for v2 and newer versions.

* Try to get metallicity form directory name

Try to get the metallicity value from the directory name in case, there is no history file.

* Correct typo

step_7 -> step_6

* Add to reset DISPLAY for plotting 

Add to reset DISPLAY for plotting step on a cluster to avoid problems when logged in with window mode on ssh.

* Check for initial RLO in join_grids

Check for initial RLO in join_grids, too.
Use a joint initial RLO boundary.

* Debug

Flush output for debugging

* Fix bug in adding too many boundary systems

Fix bug in adding too many boundary systems

* Remove debugging

Remove debugging

* Fix list entry replacement (psygrid.py)

Fix list entry replacement in psygrid.py

* Fix list entry replacement (termination_flags.py)

Fix list entry replacement in termination_flags.py

* Add STEPID

Add the number of the step to the slurm job-name

* Update last developement changes (#62)

* Fixed more dict syntax for kwargs in docs (#53)

In SingleStar object docs

* Fixed dict syntax for kwargs1, kwargs2 definitions (#52)

---------

Co-authored-by: Camille Liotine <cliotine@u.northwestern.edu>

* account for suggestions 

- add else (nevertheless it will raise an error message later; I thought I predefined STEPID, but it looks like I put it out/or missed to put it in; using job_name here as content of the STEPID is a bad idea, because it is expected to be a single character and not a string)
- add the check for the length after the split (again, this would cause an error message later nevertheless)

* rename variable

e -> exists_already

* rename

e -> exists_already

* Add run_pipeline.sh

- create the bash script "run_pipeline.sh", which starts all the setup steps with dependency

* Automatic kill on failure

set option to kill pending jobs, where the depended job failed

* Check all steps, which can run in parallel

- allow step_5 to go in parallel to step_3, too

---------

Co-authored-by: Camille Liotine <cliotine@u.northwestern.edu>

* Small changes in common function and matching post-MS to He in detached step (#45)

* Update common_functions.py

* Update step_detached.py

* Update step_mesa.py

* Update step_detached.py

* GZIP support for files in MESA grids (#23)

* Adding gzip support when reading MESA grids.

* Adding GZIP support to psygrid metadata printing.

* Adding GZIP support to grid points files.

* Adding GZIP support to EEP files.

* Clarifications for GZIP files inside the code.

* Adding more clarification regarding support of GZIP files.

* Adding GZIP support to function converting MESA output to table.

* Adding GZIP support when inferring termination flag from MESA run output.

* Adding GZIP support in EEP class.

* Correcting types in io

* Bug fix (#66)

move option "--kill-on-invalid-dep=yes" in the brackets

* isolated evolution step  (#35)

* started the step_isolated files (2 is for superclass with detached) and first changes in detached and in flow

* allowed for different psygrid for isoalted step, selected lists of stellar states, still need to solve absence of logR for mergers

* deleted old step_isolated

* made step_merging

* integrated the step_merged correctly in the flow

* before intorducing the option for not using log_R as a matching criteria, having the option do decide the parameters of the matching

* added most merger cases, still need to solve logR avsence in matching

* finished step_merged combinations

* made the new disrupted_step

* added spin of merged product

* made step_initially_single too and changes of structure after discussion with Konstantinos

* latest changes

* Eirini's change,name of mist0 to match_to_single_star

* making lists for each matching

* changes in lambda minimize function to a more general function that can take an arbitrary list

* typo

* added the option of the different list of attributes in the step_merged

* matching should work the same for all subclasses now

* syntax errors prob fixed

* fixing runtime errors in the new files

* some more fixing

* Some print statements

* change the flowchart to not go to sterp_disurpted if one of the events is detached is called

* prints

* typo in flowchart

* Friday's work

* .

* fix init orbit

* disrupted bianry evolves until CC2

* step SN updated to expect a 2nd CC in an already disrupted system. Matching for postMS and maybe HeStars may still need work

* matching fixing

* slightly improved the verbose text of the matching

* print errors

* changes to match_to_single_star

* generalized alternative matching

* for this PR, step merged does nothing

* matching happening only when needed (once)

* step merged and intially single go to step end for now

* testing cases of ZAMS stars not needed to match

* binary fraction

* minor changes in isolated or initially single

* else statement, self.companion

* typo

* deleted the option of fidning ZAMS through logR

* syntax error fixing

* resolving merging issues

* went back to grid_Hrich and grid_strippedHe

* ini file

* ini

* surf_avg_omega_div_omega_crit is not always stored, so it is no longer called for and passed to solve_ivp. It is calculated in the Matt+2015 magnetic braking calculation from stellar properties now, as it is only needed there.

* del grid from detached params

* ini

* Removed additional instances where interp1d_sec[surf_avg_omega_div_omega_crit](t - t_offset_sec) was called.

* changing the random

* removed superfluous commas in defining detached step properties

* Adding step_isolated,step_disrupted in the STEP_NAMES_LOADING_GRIDS so the metallicity can propagate in ther kwargs

* fix in ini file

* I think I went the POSYDON-MESA-INLIST submodule back

* changed class names according to CamelCase convention

* time profiling

* Corrections to the detached verbose with timestamp.

* no matching for the CO star, using m0,t0 of the previously matched star

* Giving additional option 1 in verbose to print only the matching parameters

* Step 1 in cleaning detached step.

* Step 2 in cleaing detached step.

* Removing duplicate code in square difference function.

* Deciding on which column are going to use relative distance during matching.

* Deleting obsolete transform method in detached step.

* Removing unnecessary transform when scaling columns in detached step.

* Using stored scalers and removing some useless self.grid assignments

* in the 3rd matching step, I added the change of htrack also for postMS stars

* added htrack  = star.htrack

* commenting out the relative differences during matching for center_he4

* in the 3rd alternative matching we also change the parameters used for matching to the ones according to the new htrack

* typo

* htrack is updated outside match_to_single_star to be used in the rest of get_star_data

* removed simulationproperties from CE folder...

---------

Co-authored-by: Eirini Kasdagli <kasdaglie@login6.ufhpc>
Co-authored-by: kasdaglie <kasdaglie@ufl.edu>
Co-authored-by: sg <sethg45@gmail.com>
Co-authored-by: kkovlakas <kkovla@gmail.com>

* small changes to solve issues in accepted PR35 (#74)

* Updating modules to newest versions for python 3.11 (#57)

* updating modules to newest versions for python 3.11

* merge developmet and fix sintax warning in step_SN where is not was incorrectly used whencomparig strigs

---------

Co-authored-by: ssbvr <sim.bavera@gmail.com>

* Added script for estimating detection probabilities. These are estimated using grids of pre-calculated detection probabilities living at /projects/b1119/POSYDON_GRIDS/POSYDON_popsynth_data/v2/POSYDON_data/selection_effects/grids/pdet_grid.hdf5. This file contains pdets assuming a 3-detector HLV network operating at different sensitivities. (#82)

* [insane PR 🤯] POSYDON v2 DCO population synthesis workflow (#63)

* add synthetic population parser

* bug fixes

* cleaning

* get DCO population at formation as df_synthetic, add t_inspiral and underlying stellar mass for rate calculation

* add method to compute merger efficiency

* add intrinsic and detectable populations

* define all class variables

* add visualisation modules

* small edit

* add rate calculation and SFR

* add docstrings and parser of oneline dataframe

* update pdet calculation to POSYDON selection effects

* update sensitivity docstring

* Catch corrupted mesa files for creating a psygrid (#72)

* Update gridutils.py

add a catch, if something goes wrong while reading files

* Update psygrid.py

Catch "None" in history_mod and history_age

* Ignore runs with corrupted history

Ignore runs with corrupted history

* fix typo

close an open bracket

* Remove some ignore_data again

Remove ignore_data on normal history read, to allow stars to not be included in the simulation, e.g. a CO

* Update scrubbing.py

Catch, that table might not be None, while model or age is.

* catch None

if (binary) history is None set length to 0

* making some if statements clear (#83)

* rename selection_effects.py

* adding profile interpolation (#58)

* adding profile interpolation

* adding monotonicity enforcement to main class

* fixing typo in learn_bounds and increase epochs/callbacks

* remove default path, move IF interpolator argument to train method

* changed some variable names

* adding load interpolator arg to main class init function

* changing arg name from interpolator to IF_interpolator to prevent confusion

* adding docs for prof interpolation

* fixed file format for docs

* fix typo

* removed extraneous line

* addressing some stylistic issues

* resolve various issues

* changed name of finalmass to final_m1, added missing states to X_H class

* fixed missing return in mono renorm

* addressing Philipp's comments; changing a few argument/variable names, added arguments for model training parameters

---------

Co-authored-by: Elizabeth Teng <elizabethteng@u.northwestern.edu>

* Post processing pipeline prepare master ini (#91)

* allow to remove slices from combining grids and only remove the combining if all slices are missing

* Update setup-pipeline

correct some typos

* track previously created files

* Update setup-pipeline

fix typo

* get files from step 1

* change range over df shape to instead use the index object

* turn any to check on length

* add check for no slurm tasks

* account for larger length difference of histories

* reuse columns from histories if possible, add warnings

* bugfix

* add open-mode, remove old file (make a copy first)

* allow to ignore bad charaters in MESA log files

* drop rows and columns

* Allow grid end at He depletion (for massive stars) (#89)

* Add function "keep_till_He_depletion"

* Add option to stop at He depletion

* Add option to pipeline (remove later)

* correct not

* Change threshold for He depletion

* allow histories without age, add new flag

* Check for history of 0 length

* add C criterion for He depletion

add C criterion for He depletion

* Update psygrid.py

use 0.08 carbon abundance

* Update scrubbing.py

where can't handle two arrays in parallel

* Update psygrid.py

change C limit to 0.1

* Update psygrid.py

Add mass request to only apply stopping earlier to masses of 100Msun and above

* Update run-pipeline

remove "_He_depletion" extension for the file name of the hdf5 file containing the psygrid

* rename function and flags

* Update psygrid.py

correct typo

* Support arbitrary MODEL for double compact object rates (#95)

* add synthetic population parser

* bug fixes

* cleaning

* get DCO population at formation as df_synthetic, add t_inspiral and underlying stellar mass for rate calculation

* add method to compute merger efficiency

* add intrinsic and detectable populations

* define all class variables

* add visualisation modules

* small edit

* add rate calculation and SFR

* add docstrings and parser of oneline dataframe

* update pdet calculation to POSYDON selection effects

* update sensitivity docstring

* support arbitrary MODEL for rate calculation

* fix

* Add support for post processing an arbitrary number of core-collapse models + introduce H envelope option to step_SN + v2 data pop synth debugged (#70)

* Add function "keep_till_He_depletion"

* Add option to stop at He depletion

* Add option to pipeline (remove later)

* correct not

* Change threshold for He depletion

* allow histories without age, add new flag

* Check for history of 0 length

* support BH formation above PISN gap and direct/Fryer collapse prescriptions now assume hydrogen envelope does not go into the BH

* add C criterion for He depletion

add C criterion for He depletion

* Update psygrid.py

use 0.08 carbon abundance

* Update scrubbing.py

where can't handle two arrays in parallel

* Update psygrid.py

change C limit to 0.1

* support the option to conserve the hydrogen envelope in BH formation

* add MODEL var to post processing

* update post processing script to support multiple core collapse models

* Update psygrid.py

Add mass request to only apply stopping earlier to masses of 100Msun and above

* Update run-pipeline

remove "_He_depletion" extension for the file name of the hdf5 file containing the psygrid

* debug

* rename function and flags

* add support for BH disk mass

* allow to remove slices from combining grids and only remove the combining if all slices are missing

* fix small bug

* Update setup-pipeline

correct some typos

* track previously created files

* Update setup-pipeline

fix typo

* get files from step 1

* change range over df shape to instead use the index object

* update step_6 run-pipeline

* turn any to check on length

* debug

* add check for no slurm tasks

* account for larger length difference of histories

* reuse columns from histories if possible, add warnings

* bugfix

* propagate changes in step_SN and step_MESA

* fix bug

* debug plot2D

* remove circular import

* add open-mode, remove old file (make a copy first)

* allow to ignore bad charaters in MESA log files

* drop rows and columns

* change import

* import TF1 for post processing

* fix bug

* Update psygrid.py

correct typo

* debug

* roll fix for single stars as well

* debug

* Matthias split grid rlo (#99)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* debug single interpolation

* add support for other metallicities

* update Z to Y conversion

* SN_type not diclared in star properties

* debug

* update default params ini

* increase len interp_class column

* update params ini

* add authorship to MODEL.py

* Matthias split grid rlo (#100)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* Update setup-pipeline

Add RLO to steps 6 and 7

* Update setup-pipeline

Correct step 7

* Update run-pipeline

don't interpolate no_MT for any grid starting at RLO

* Update run-pipeline

remove "_RLO" from method, which is read from the filename

* Update setup-pipeline

add "CO-HeMS_RLO" to export dirs

* update spin orbit tilt name in rate calculation

---------

Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>
Co-authored-by: mkruckow <Matthias.Kruckow@unige.ch>

* Initially single stars and merged isolated evolution (#92)

* started the step_isolated files (2 is for superclass with detached) and first changes in detached and in flow

* allowed for different psygrid for isoalted step, selected lists of stellar states, still need to solve absence of logR for mergers

* deleted old step_isolated

* made step_merging

* integrated the step_merged correctly in the flow

* before intorducing the option for not using log_R as a matching criteria, having the option do decide the parameters of the matching

* added most merger cases, still need to solve logR avsence in matching

* finished step_merged combinations

* made the new disrupted_step

* added spin of merged product

* made step_initially_single too and changes of structure after discussion with Konstantinos

* latest changes

* Eirini's change,name of mist0 to match_to_single_star

* making lists for each matching

* changes in lambda minimize function to a more general function that can take an arbitrary list

* typo

* added the option of the different list of attributes in the step_merged

* matching should work the same for all subclasses now

* syntax errors prob fixed

* fixing runtime errors in the new files

* some more fixing

* Some print statements

* change the flowchart to not go to sterp_disurpted if one of the events is detached is called

* prints

* typo in flowchart

* Friday's work

* .

* fix init orbit

* disrupted bianry evolves until CC2

* step SN updated to expect a 2nd CC in an already disrupted system. Matching for postMS and maybe HeStars may still need work

* matching fixing

* slightly improved the verbose text of the matching

* print errors

* changes to match_to_single_star

* generalized alternative matching

* for this PR, step merged does nothing

* matching happening only when needed (once)

* step merged and intially single go to step end for now

* testing cases of ZAMS stars not needed to match

* binary fraction

* minor changes in isolated or initially single

* else statement, self.companion

* typo

* deleted the option of fidning ZAMS through logR

* syntax error fixing

* resolving merging issues

* went back to grid_Hrich and grid_strippedHe

* ini file

* ini

* surf_avg_omega_div_omega_crit is not always stored, so it is no longer called for and passed to solve_ivp. It is calculated in the Matt+2015 magnetic braking calculation from stellar properties now, as it is only needed there.

* del grid from detached params

* ini

* Removed additional instances where interp1d_sec[surf_avg_omega_div_omega_crit](t - t_offset_sec) was called.

* changing the random

* removed superfluous commas in defining detached step properties

* Adding step_isolated,step_disrupted in the STEP_NAMES_LOADING_GRIDS so the metallicity can propagate in ther kwargs

* fix in ini file

* I think I went the POSYDON-MESA-INLIST submodule back

* changed class names according to CamelCase convention

* time profiling

* Corrections to the detached verbose with timestamp.

* no matching for the CO star, using m0,t0 of the previously matched star

* Giving additional option 1 in verbose to print only the matching parameters

* printing of more timing profiling

* Step 1 in cleaning detached step.

* Step 2 in cleaing detached step.

* Removing duplicate code in square difference function.

* Deciding on which column are going to use relative distance during matching.

* Deleting obsolete transform method in detached step.

* Removing unnecessary transform when scaling columns in detached step.

* Using stored scalers and removing some useless self.grid assignments

* adding massless in the star states in flow chart

* Adding massless_remant and a compact binary state list for the detached. Adding initially single stars in the step names for metallisity

* fixing the primary.co in some elif

* fixing the infite loop created by the flow chart

* metallicity = 1 as default

* in the flow, a CO+massless goes to step_end

* going to step initially single only after ZAMS

* pulled merged step from manos_merged_step

* pulled the isolated step and the population defaults for all substeps (disrupted, initially_single, merged)

* pulled step_SN, flow, and step_detached

* added step_merged in steps that need a metallicity (in binarypopulations.py)

* IsolatedStep changes

* fixing the STAR_STATES_ALL in the flow_chart

* properties_massless_remnant in common function

* convert_massless_remenant in merged

* properties massless in SingleStar class instead

* corrected massless_remnant dictionary

* fixing the state after CC1 in merged and single stars

* set initial period and separation for single star equal to nan

* deleting some unnecessary comments

* deleting repeated dictionaries in detached

* reverting the changes in MESA-INLISTS

* Update step_detached.py

* Update binarystar.py

---------

Co-authored-by: ezapartas <ezapartas@gmail.com>
Co-authored-by: Eirini Kasdagli <kasdaglie@login6.ufhpc>
Co-authored-by: sg <sethg45@gmail.com>
Co-authored-by: kkovlakas <kkovla@gmail.com>

* Fixes to orbital_kick in step_SN (#39)

* Fixing coordinate frame inconsistency in orbital_kick()

* more documentation for orbital_kick fix

* fixed issue with cos_psi being limited to >0

---------

Co-authored-by: Jeff Andrews <jeffrey.andrews@northwestern.edu>

* updates to profile interpolation (#101)

* adding profile interpolation

* adding monotonicity enforcement to main class

* fixing typo in learn_bounds and increase epochs/callbacks

* remove default path, move IF interpolator argument to train method

* changed some variable names

* adding load interpolator arg to main class init function

* changing arg name from interpolator to IF_interpolator to prevent confusion

* adding docs for prof interpolation

* fixed file format for docs

* fix typo

* removed extraneous line

* addressing some stylistic issues

* resolve various issues

* changed name of finalmass to final_m1, added missing states to X_H class

* fixed missing return in mono renorm

* addressing Philipp's comments; changing a few argument/variable names, added arguments for model training parameters

* adding tensorflow to extras_require

* fixed typo and added comment for tensorflow dependency

* added helium profile interpolation, updated docs

* update compiledata to include option for star 2, add MT class to dataframe

* condensed a for loop

* fixed a few bugs

* moved some definitions around

* make 80/20 split for validation data from training data

* typos

* allowed for star 2 in all classes

* got rid of feature that would make predictions from untrained models for final star states with no training data

* Update setup.py

---------

Co-authored-by: Elizabeth Teng <elizabethteng@u.northwestern.edu>
Co-authored-by: Jeff Andrews <jeffrey.andrews@ufl.edu>

* Seth TPAGBwind pipeline (#102)

* Added an agb_wind rerun type (to perform reruns that will have the Bloecker AGB wind enabled).

* removed the initial mass < 10 Msol check

* Update run-pipeline

---------

Co-authored-by: Seth Shearer Gossage <ssg9761@quser32.quest.it.northwestern.edu>
Co-authored-by: Seth Shearer Gossage <ssg9761@quser33.quest.it.northwestern.edu>
Co-authored-by: Jeff Andrews <jeffrey.andrews@northwestern.edu>

* Update step_SN.py (#108)

Missing comment block

* Update setup.py (#107)

Adding a comma

* Update run-pipeline (#109)

set tpabg to False in case of a missing history, e.g. if there is a CO instead of a star

* Introducing GRB properties and rate calculations (#103)

* Add function "keep_till_He_depletion"

* Add option to stop at He depletion

* Add option to pipeline (remove later)

* correct not

* Change threshold for He depletion

* allow histories without age, add new flag

* Check for history of 0 length

* support BH formation above PISN gap and direct/Fryer collapse prescriptions now assume hydrogen envelope does not go into the BH

* add C criterion for He depletion

add C criterion for He depletion

* Update psygrid.py

use 0.08 carbon abundance

* Update scrubbing.py

where can't handle two arrays in parallel

* Update psygrid.py

change C limit to 0.1

* support the option to conserve the hydrogen envelope in BH formation

* add MODEL var to post processing

* update post processing script to support multiple core collapse models

* Update psygrid.py

Add mass request to only apply stopping earlier to masses of 100Msun and above

* Update run-pipeline

remove "_He_depletion" extension for the file name of the hdf5 file containing the psygrid

* debug

* rename function and flags

* add support for BH disk mass

* allow to remove slices from combining grids and only remove the combining if all slices are missing

* fix small bug

* Update setup-pipeline

correct some typos

* track previously created files

* Update setup-pipeline

fix typo

* get files from step 1

* change range over df shape to instead use the index object

* update step_6 run-pipeline

* turn any to check on length

* debug

* add check for no slurm tasks

* account for larger length difference of histories

* reuse columns from histories if possible, add warnings

* bugfix

* propagate changes in step_SN and step_MESA

* fix bug

* debug plot2D

* remove circular import

* add open-mode, remove old file (make a copy first)

* allow to ignore bad charaters in MESA log files

* drop rows and columns

* change import

* import TF1 for post processing

* fix bug

* Update psygrid.py

correct typo

* debug

* roll fix for single stars as well

* debug

* Matthias split grid rlo (#99)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* debug single interpolation

* add support for other metallicities

* update Z to Y conversion

* SN_type not diclared in star properties

* debug

* update default params ini

* increase len interp_class column

* update params ini

* add authorship to MODEL.py

* Matthias split grid rlo (#100)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* Update setup-pipeline

Add RLO to steps 6 and 7

* Update setup-pipeline

Correct step 7

* Update run-pipeline

don't interpolate no_MT for any grid starting at RLO

* Update run-pipeline

remove "_RLO" from method, which is read from the filename

* Update setup-pipeline

add "CO-HeMS_RLO" to export dirs

* update spin orbit tilt name in rate calculation

* adding function get_formation_channels

* in parse function, shifting the binary_index

* compute GRB properties

* add channelwise merger efficiency calculation and plotting

* add channelwise rate density

* support channelwise histogram distributions

* add file authorship

* debug

* cosistency change

* add GRB rate calculation

* fixing shift in binary index

* minor bug

* debug

* debug

* debug

* address PR103 PR104 comments

* remove bug introduced in previous comment

* remove bug introduced in previous commit

* debug

---------

Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>
Co-authored-by: mkruckow <Matthias.Kruckow@unige.ch>
Co-authored-by: Monica Gallegos-Garcia <monicagallegosgarcia2024@u.northwestern.edu>

* profile interpolation update (#111)

* adding profile interpolation

* adding monotonicity enforcement to main class

* fixing typo in learn_bounds and increase epochs/callbacks

* remove default path, move IF interpolator argument to train method

* changed some variable names

* adding load interpolator arg to main class init function

* changing arg name from interpolator to IF_interpolator to prevent confusion

* adding docs for prof interpolation

* fixed file format for docs

* fix typo

* removed extraneous line

* addressing some stylistic issues

* resolve various issues

* changed name of finalmass to final_m1, added missing states to X_H class

* fixed missing return in mono renorm

* addressing Philipp's comments; changing a few argument/variable names, added arguments for model training parameters

* adding tensorflow to extras_require

* fixed typo and added comment for tensorflow dependency

* added helium profile interpolation, updated docs

* update compiledata to include option for star 2, add MT class to dataframe

* condensed a for loop

* fixed a few bugs

* moved some definitions around

* make 80/20 split for validation data from training data

* typos

* allowed for star 2 in all classes

* got rid of feature that would make predictions from untrained models for final star states with no training data

* Update setup.py

* testing branch

* undo

* Update ProfileInterpolator.rst

* update comments and docstrings, fix star 1/star 2 stuff in composition class

* adding missing argument name

* fixed comment

* update tensorflow version to 2.13 to avoid installation issues

* added omega profiles normalized by omega/omega_crit

---------

Co-authored-by: Elizabeth Teng <elizabethteng@u.northwestern.edu>
Co-authored-by: Jeff Andrews <jeffrey.andrews@ufl.edu>
Co-authored-by: Simone Bavera <32518238+ssbvr@users.noreply.github.com>

* Allowing for relative paths in the pipeline (#113)

* Update gridutils.py

* Update gridutils.py

Use os functionalities instead

* Update step_mesa.py

Use os functionality

* Update run-pipeline

Use os functionalities

* Update posydon-setup-grid

Use os functionality
correct bug (use file name instead of first directory name)

* Update compress-mesa

Use os functionality

* Update step_detached.py, corrected order of magnitude on Rappaport, Verbunt, and Joss 1983 prescription in step_detached (#114)

The leading constant should have been 3.8e-30, not 3.8e30.

* Fix coefficinent SFRH Neijssel+19 (#112)

* Add function "keep_till_He_depletion"

* Add option to stop at He depletion

* Add option to pipeline (remove later)

* correct not

* Change threshold for He depletion

* allow histories without age, add new flag

* Check for history of 0 length

* support BH formation above PISN gap and direct/Fryer collapse prescriptions now assume hydrogen envelope does not go into the BH

* add C criterion for He depletion

add C criterion for He depletion

* Update psygrid.py

use 0.08 carbon abundance

* Update scrubbing.py

where can't handle two arrays in parallel

* Update psygrid.py

change C limit to 0.1

* support the option to conserve the hydrogen envelope in BH formation

* add MODEL var to post processing

* update post processing script to support multiple core collapse models

* Update psygrid.py

Add mass request to only apply stopping earlier to masses of 100Msun and above

* Update run-pipeline

remove "_He_depletion" extension for the file name of the hdf5 file containing the psygrid

* debug

* rename function and flags

* add support for BH disk mass

* allow to remove slices from combining grids and only remove the combining if all slices are missing

* fix small bug

* Update setup-pipeline

correct some typos

* track previously created files

* Update setup-pipeline

fix typo

* get files from step 1

* change range over df shape to instead use the index object

* update step_6 run-pipeline

* turn any to check on length

* debug

* add check for no slurm tasks

* account for larger length difference of histories

* reuse columns from histories if possible, add warnings

* bugfix

* propagate changes in step_SN and step_MESA

* fix bug

* debug plot2D

* remove circular import

* add open-mode, remove old file (make a copy first)

* allow to ignore bad charaters in MESA log files

* drop rows and columns

* change import

* import TF1 for post processing

* fix bug

* Update psygrid.py

correct typo

* debug

* roll fix for single stars as well

* debug

* Matthias split grid rlo (#99)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* debug single interpolation

* add support for other metallicities

* update Z to Y conversion

* SN_type not diclared in star properties

* debug

* update default params ini

* increase len interp_class column

* update params ini

* add authorship to MODEL.py

* Matthias split grid rlo (#100)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* Update setup-pipeline

Add RLO to steps 6 and 7

* Update setup-pipeline

Correct step 7

* Update run-pipeline

don't interpolate no_MT for any grid starting at RLO

* Update run-pipeline

remove "_RLO" from method, which is read from the filename

* Update setup-pipeline

add "CO-HeMS_RLO" to export dirs

* update spin orbit tilt name in rate calculation

* adding function get_formation_channels

* in parse function, shifting the binary_index

* compute GRB properties

* add channelwise merger efficiency calculation and plotting

* add channelwise rate density

* support channelwise histogram distributions

* add file authorship

* debug

* cosistency change

* add GRB rate calculation

* debug

* debug

* debug

* address PR103 PR104 comments

* remove bug introduced in previous comment

* remove bug introduced in previous commit

* bug fix

---------

Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>
Co-authored-by: mkruckow <Matthias.Kruckow@unige.ch>
Co-authored-by: Monica Gallegos-Garcia <monicagallegosgarcia2024@u.northwestern.edu>

* Plot popsyn values over grid slices (#115)

* Add function "keep_till_He_depletion"

* Add option to stop at He depletion

* Add option to pipeline (remove later)

* correct not

* Change threshold for He depletion

* allow histories without age, add new flag

* Check for history of 0 length

* support BH formation above PISN gap and direct/Fryer collapse prescriptions now assume hydrogen envelope does not go into the BH

* add C criterion for He depletion

add C criterion for He depletion

* Update psygrid.py

use 0.08 carbon abundance

* Update scrubbing.py

where can't handle two arrays in parallel

* Update psygrid.py

change C limit to 0.1

* support the option to conserve the hydrogen envelope in BH formation

* add MODEL var to post processing

* update post processing script to support multiple core collapse models

* Update psygrid.py

Add mass request to only apply stopping earlier to masses of 100Msun and above

* Update run-pipeline

remove "_He_depletion" extension for the file name of the hdf5 file containing the psygrid

* debug

* rename function and flags

* add support for BH disk mass

* allow to remove slices from combining grids and only remove the combining if all slices are missing

* fix small bug

* Update setup-pipeline

correct some typos

* track previously created files

* Update setup-pipeline

fix typo

* get files from step 1

* change range over df shape to instead use the index object

* update step_6 run-pipeline

* turn any to check on length

* debug

* add check for no slurm tasks

* account for larger length difference of histories

* reuse columns from histories if possible, add warnings

* bugfix

* propagate changes in step_SN and step_MESA

* fix bug

* debug plot2D

* remove circular import

* add open-mode, remove old file (make a copy first)

* allow to ignore bad charaters in MESA log files

* drop rows and columns

* change import

* import TF1 for post processing

* fix bug

* Update psygrid.py

correct typo

* debug

* roll fix for single stars as well

* debug

* Matthias split grid rlo (#99)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* debug single interpolation

* add support for other metallicities

* update Z to Y conversion

* SN_type not diclared in star properties

* debug

* update default params ini

* increase len interp_class column

* update params ini

* add authorship to MODEL.py

* Matthias split grid rlo (#100)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* Update setup-pipeline

Add RLO to steps 6 and 7

* Update setup-pipeline

Correct step 7

* Update run-pipeline

don't interpolate no_MT for any grid starting at RLO

* Update run-pipeline

remove "_RLO" from method, which is read from the filename

* Update setup-pipeline

add "CO-HeMS_RLO" to export dirs

* update spin orbit tilt name in rate calculation

* adding function get_formation_channels

* in parse function, shifting the binary_index

* compute GRB properties

* add channelwise merger efficiency calculation and plotting

* add channelwise rate density

* support channelwise histogram distributions

* add file authorship

* debug

* cosistency change

* add GRB rate calculation

* fixing shift in binary index

* minor bug

* debug

* debug

* debug

* address PR103 PR104 comments

* remove bug introduced in previous comment

* remove bug introduced in previous commit

* debug

* add plot_popsyn_over_grid_slice

* debug

* address Matthias points

* fix zorder

---------

Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>
Co-authored-by: mkruckow <Matthias.Kruckow@unige.ch>
Co-authored-by: Monica Gallegos-Garcia <monicagallegosgarcia2024@u.northwestern.edu>

* Add multi panel plots to plot2D (#118)

* Add multi panel plots

* add missing desciption

* fix grid post processing WD and above PISN BH formation (#119)

* Fix missing Z values in case of missing history files (#120)

* Hdf5 refactor - data types for population output (#88)

* Adding default dtype dicts.

* Adding conversion back to object because saving string dtypes in pandas is broken

* Adding dtype logic to oneline

* Moved around the logic for cleaning data out of to_df and made helper methods in popsyn.io

* Removed old commented out code fixed some docs and from_df methods

* Remove comments and add some docs

* Add compression options for HDFStore

* remove old imports

* remove wrong code for kick in eccentric orbit (#121)

* Update scrubbing.py (#123)

Use h2_colnames

* Update binarypopulation.py (#128)

Avoid double loading of BinaryStar

* Update profile_interpolation.py

Now we have a warning to catch errors when users try to import tensorflow, but have not installed it.

* Merge 124 and 125 (#126)

* implemented confusion matrix and violin plots, some bugs and finishing touches remain on the to do list

* confusion matrices working

* trying to plot errors in grid slices

* added plot 2d, running into latek bug

* fixed violin plots (there were lots of nans because we don't interpolate  initial_MT)

* plot 2d is working, will need to test and ask Simone and Mathias for additional features that they would like

* cleaning plot_grid method

* add processed columns to step_plot

* revert to developent

* cleaning

* allow to specify arbitrary magnitude key

* display inf

* New pipeline structure

* support all grids

* Fix some typos

* add support for interp_err

* Don't append rows twice if more than one needed file is missing.

* debug

* Fix to get STEP correctly

* Remove debuging output

* Fix: turn directory checks into file checks, where files are used instead of directories.

* No verbose on checks; correct typo.

* fix typo again

* fixes

* Update (#127)

* Fix coefficinent SFRH Neijssel+19 (#112)

* Add function "keep_till_He_depletion"

* Add option to stop at He depletion

* Add option to pipeline (remove later)

* correct not

* Change threshold for He depletion

* allow histories without age, add new flag

* Check for history of 0 length

* support BH formation above PISN gap and direct/Fryer collapse prescriptions now assume hydrogen envelope does not go into the BH

* add C criterion for He depletion

add C criterion for He depletion

* Update psygrid.py

use 0.08 carbon abundance

* Update scrubbing.py

where can't handle two arrays in parallel

* Update psygrid.py

change C limit to 0.1

* support the option to conserve the hydrogen envelope in BH formation

* add MODEL var to post processing

* update post processing script to support multiple core collapse models

* Update psygrid.py

Add mass request to only apply stopping earlier to masses of 100Msun and above

* Update run-pipeline

remove "_He_depletion" extension for the file name of the hdf5 file containing the psygrid

* debug

* rename function and flags

* add support for BH disk mass

* allow to remove slices from combining grids and only remove the combining if all slices are missing

* fix small bug

* Update setup-pipeline

correct some typos

* track previously created files

* Update setup-pipeline

fix typo

* get files from step 1

* change range over df shape to instead use the index object

* update step_6 run-pipeline

* turn any to check on length

* debug

* add check for no slurm tasks

* account for larger length difference of histories

* reuse columns from histories if possible, add warnings

* bugfix

* propagate changes in step_SN and step_MESA

* fix bug

* debug plot2D

* remove circular import

* add open-mode, remove old file (make a copy first)

* allow to ignore bad charaters in MESA log files

* drop rows and columns

* change import

* import TF1 for post processing

* fix bug

* Update psygrid.py

correct typo

* debug

* roll fix for single stars as well

* debug

* Matthias split grid rlo (#99)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* debug single interpolation

* add support for other metallicities

* update Z to Y conversion

* SN_type not diclared in star properties

* debug

* update default params ini

* increase len interp_class column

* update params ini

* add authorship to MODEL.py

* Matthias split grid rlo (#100)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* Update setup-pipeline

Add RLO to steps 6 and 7

* Update setup-pipeline

Correct step 7

* Update run-pipeline

don't interpolate no_MT for any grid starting at RLO

* Update run-pipeline

remove "_RLO" from method, which is read from the filename

* Update setup-pipeline

add "CO-HeMS_RLO" to export dirs

* update spin orbit tilt name in rate calculation

* adding function get_formation_channels

* in parse function, shifting the binary_index

* compute GRB properties

* add channelwise merger efficiency calculation and plotting

* add channelwise rate density

* support channelwise histogram distributions

* add file authorship

* debug

* cosistency change

* add GRB rate calculation

* debug

* debug

* debug

* address PR103 PR104 comments

* remove bug introduced in previous comment

* remove bug introduced in previous commit

* bug fix

---------

Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>
Co-authored-by: mkruckow <Matthias.Kruckow@unige.ch>
Co-authored-by: Monica Gallegos-Garcia <monicagallegosgarcia2024@u.northwestern.edu>

* Plot popsyn values over grid slices (#115)

* Add function "keep_till_He_depletion"

* Add option to stop at He depletion

* Add option to pipeline (remove later)

* correct not

* Change threshold for He depletion

* allow histories without age, add new flag

* Check for history of 0 length

* support BH formation above PISN gap and direct/Fryer collapse prescriptions now assume hydrogen envelope does not go into the BH

* add C criterion for He depletion

add C criterion for He depletion

* Update psygrid.py

use 0.08 carbon abundance

* Update scrubbing.py

where can't handle two arrays in parallel

* Update psygrid.py

change C limit to 0.1

* support the option to conserve the hydrogen envelope in BH formation

* add MODEL var to post processing

* update post processing script to support multiple core collapse models

* Update psygrid.py

Add mass request to only apply stopping earlier to masses of 100Msun and above

* Update run-pipeline

remove "_He_depletion" extension for the file name of the hdf5 file containing the psygrid

* debug

* rename function and flags

* add support for BH disk mass

* allow to remove slices from combining grids and only remove the combining if all slices are missing

* fix small bug

* Update setup-pipeline

correct some typos

* track previously created files

* Update setup-pipeline

fix typo

* get files from step 1

* change range over df shape to instead use the index object

* update step_6 run-pipeline

* turn any to check on length

* debug

* add check for no slurm tasks

* account for larger length difference of histories

* reuse columns from histories if possible, add warnings

* bugfix

* propagate changes in step_SN and step_MESA

* fix bug

* debug plot2D

* remove circular import

* add open-mode, remove old file (make a copy first)

* allow to ignore bad charaters in MESA log files

* drop rows and columns

* change import

* import TF1 for post processing

* fix bug

* Update psygrid.py

correct typo

* debug

* roll fix for single stars as well

* debug

* Matthias split grid rlo (#99)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* debug single interpolation

* add support for other metallicities

* update Z to Y conversion

* SN_type not diclared in star properties

* debug

* update default params ini

* increase len interp_class column

* update params ini

* add authorship to MODEL.py

* Matthias split grid rlo (#100)

* fix in psygrid.py

fix check of initial mass when cutting off carbon depletion

* Update run-pipeline

get start_at_RLO from compression type
add flag to stop before carbon depletion (allow only for HMS grids)

* Update setup-pipeline

remove CO_HMS_GRID_START_AT_RLO
add STOP_BEFORE_CARBON_DEPLETION

* Update setup-pipeline

get different directory for plotting if compression contains "RLO"

* Update setup-pipeline

correct typo

* Update psygrid.py

correct typo

* Update psygrid.py

debug

* Update setup-pipeline

Add RLO to steps 6 and 7

* Update setup-pipeline

Correct step 7

* Update run-pipeline

don't interpolate no_MT for any grid starting at RLO

* Update run-pipeline

remove "_RLO" from method, which is read from the filename

* Update setup-pipeline

add "CO-HeMS_RLO" to export dirs

* update spin orbit tilt name in rate calculation

* adding function get_formation_channels

* in parse function, shifting the binary_index

* compute GRB properties

* add channelwise merger efficiency calculation and plotting

* add channelwise rate density

* support channelwise histogram distributions

* add file authorship

* debug

* cosistency change

* add GRB rate calculation

* fixing shift in binary index

* minor bug

* debug

* debug

* debug

* address PR103 PR104 comments

* remove bug introduced in previous comment

* remove bug introduced in previous commit

* debug

* add plot_popsyn_over_grid_slice

* debug

* address Matthias points

* fix zorder

---------

Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>
Co-authored-by: mkruckow <Matthias.Kruckow@unige.ch>
Co-authored-by: Monica Gallegos-Garcia <monicagallegosgarcia2024@u.northwestern.edu>

* Add multi panel plots to plot2D (#118)

* Add multi panel plots

* add missing desciption

* fix grid post processing WD and above PISN BH formation (#119)

* Fix missing Z values in case of missing history files (#120)

* Hdf5 refactor - data types for population output (#88)

* Adding default dtype dicts.

* Adding conversion back to object because saving string dtypes in pandas is broken

* Adding dtype logic to oneline

* Moved around the logic for cleaning data out of to_df and made helper methods in popsyn.io

* Removed old commented out code fixed some docs and from_df methods

* Remove comments and add some docs

* Add compression options for HDFStore

* remove old imports

* remove wrong code for kick in eccentric orbit (#121)

* Update scrubbing.py (#123)

Use h2_colnames

---------

Co-authored-by: Simone Bavera <32518238+ssbvr@users.noreply.github.com>
Co-authored-by: Monica Gallegos-Garcia <monicagallegosgarcia2024@u.northwestern.edu>
Co-authored-by: Kyle Rocha <48293898+ka-rocha@users.noreply.github.com>

* fixes

* Update binarypopulation.py

Avoid double loading of BinaryStar

* include PR128

* fix: keys of final_values

* fix typo: uppercase to lowercase

* catch when print fails

* fix: CONTROL_GRIDS being a list of lists of strings

* minor fix to address stellar states of not converged runs

* fix: recongize _RLO in compression

* previous fix was incomplete -> improve

* use lists in substeps (#131)

use lists in the csv files -> thus, it now loops inside the plotting function
generalize the creation of plot attributes to need less predefined dictionary entries
additionally, I made some other lift ups on the code, e.g. always using uppercase letters on stuff which is a category.

* avoid to double RLO in directory names

* add more quantities to plot

* small bug

* remove duplicated label

* fix small plotting bug

---------

Co-authored-by: prinse1545 <philipp.msrivastava@gmail.com>
Co-authored-by: mkruckow <Matthias.Kruckow@unige.ch>
Co-authored-by: mkruckow <122798003+mkruckow@users.noreply.github.com>
Co-authored-by: Monica Gallegos-Garcia <monicagallegosgarcia2024@u.northwestern.edu>
Co-authored-by: Kyle Rocha <48293898+ka-rocha@users.noreply.github.com>

* Konst removing init imports (#132)

* Removing imports in init files.

* Removing unused imports.

* Correcting import statements after removing imports in init files.

* Added a TODO not for a possible mistake.

* Correcting another import.

* introducing step_CO_HeMS_RLO (#122)

* remove wrong code for kick in eccentric orbit

* introducing step_CO-HeMS_RLO

* spelling

* minor change to catch collapsing stars states in step

* add interp_class_CO_HeMS_RLO to binarystar.py

* fix bug on characters lenght of step_names

* PR88 defaul params ini change

* minor changes

* fix two small bugs

* fix SN MODEL properties for nearest_neighbour interpolation

* add rerun type: thermohaline_mixing (#136)

* Vhd multiple (#139)

* Modules & documetations

* remove unrelevant classes from presenter.py

* remove unrelevant classes from presenter.py

* correct pyqt5 python 3.11 issues, _remove_duplicate(), docs and comments plus minor changes

---------

Co-authored-by: Wène Kouarfate <wene.kouarfate@students.hevs.ch>

* Create deploy-github-pages-unstable.yml (#145)

Adding GitHub Actions workflow for deploying the unstable version documentation.

* Correcting the boolean logic in deciding single/binary evolution in the detached step. (#140)

* Update deploy-github-pages-unstable.yml

Correcting the PYTHON version in the unstable documentation github action workflow

* redirect keeps info from before (#141)

* manoscommit

* added a change of a redirect if statement i…
elizabethteng pushed a commit that referenced this pull request Jul 29, 2025
* started the step_isolated files (2 is for superclass with detached) and first changes in detached and in flow

* allowed for different psygrid for isoalted step, selected lists of stellar states, still need to solve absence of logR for mergers

* deleted old step_isolated

* made step_merging

* integrated the step_merged correctly in the flow

* before intorducing the option for not using log_R as a matching criteria, having the option do decide the parameters of the matching

* added most merger cases, still need to solve logR avsence in matching

* finished step_merged combinations

* made the new disrupted_step

* added spin of merged product

* made step_initially_single too and changes of structure after discussion with Konstantinos

* latest changes

* Eirini's change,name of mist0 to match_to_single_star

* making lists for each matching

* changes in lambda minimize function to a more general function that can take an arbitrary list

* typo

* added the option of the different list of attributes in the step_merged

* matching should work the same for all subclasses now

* syntax errors prob fixed

* fixing runtime errors in the new files

* some more fixing

* Some print statements

* change the flowchart to not go to sterp_disurpted if one of the events is detached is called

* prints

* typo in flowchart

* Friday's work

* .

* fix init orbit

* disrupted bianry evolves until CC2

* step SN updated to expect a 2nd CC in an already disrupted system. Matching for postMS and maybe HeStars may still need work

* matching fixing

* slightly improved the verbose text of the matching

* print errors

* changes to match_to_single_star

* generalized alternative matching

* for this PR, step merged does nothing

* matching happening only when needed (once)

* step merged and intially single go to step end for now

* testing cases of ZAMS stars not needed to match

* binary fraction

* minor changes in isolated or initially single

* else statement, self.companion

* typo

* deleted the option of fidning ZAMS through logR

* syntax error fixing

* resolving merging issues

* went back to grid_Hrich and grid_strippedHe

* ini file

* ini

* surf_avg_omega_div_omega_crit is not always stored, so it is no longer called for and passed to solve_ivp. It is calculated in the Matt+2015 magnetic braking calculation from stellar properties now, as it is only needed there.

* del grid from detached params

* ini

* Removed additional instances where interp1d_sec[surf_avg_omega_div_omega_crit](t - t_offset_sec) was called.

* changing the random

* removed superfluous commas in defining detached step properties

* Adding step_isolated,step_disrupted in the STEP_NAMES_LOADING_GRIDS so the metallicity can propagate in ther kwargs

* fix in ini file

* I think I went the POSYDON-MESA-INLIST submodule back

* changed class names according to CamelCase convention

* time profiling

* Corrections to the detached verbose with timestamp.

* no matching for the CO star, using m0,t0 of the previously matched star

* Giving additional option 1 in verbose to print only the matching parameters

* Step 1 in cleaning detached step.

* Step 2 in cleaing detached step.

* Removing duplicate code in square difference function.

* Deciding on which column are going to use relative distance during matching.

* Deleting obsolete transform method in detached step.

* Removing unnecessary transform when scaling columns in detached step.

* Using stored scalers and removing some useless self.grid assignments

* in the 3rd matching step, I added the change of htrack also for postMS stars

* added htrack  = star.htrack

* commenting out the relative differences during matching for center_he4

* in the 3rd alternative matching we also change the parameters used for matching to the ones according to the new htrack

* typo

* htrack is updated outside match_to_single_star to be used in the rest of get_star_data

* removed simulationproperties from CE folder...

---------

Co-authored-by: Eirini Kasdagli <kasdaglie@login6.ufhpc>
Co-authored-by: kasdaglie <kasdaglie@ufl.edu>
Co-authored-by: sg <sethg45@gmail.com>
Co-authored-by: kkovlakas <kkovla@gmail.com>
elizabethteng pushed a commit that referenced this pull request Oct 30, 2025
* started the step_isolated files (2 is for superclass with detached) and first changes in detached and in flow

* allowed for different psygrid for isoalted step, selected lists of stellar states, still need to solve absence of logR for mergers

* deleted old step_isolated

* made step_merging

* integrated the step_merged correctly in the flow

* before intorducing the option for not using log_R as a matching criteria, having the option do decide the parameters of the matching

* added most merger cases, still need to solve logR avsence in matching

* finished step_merged combinations

* made the new disrupted_step

* added spin of merged product

* made step_initially_single too and changes of structure after discussion with Konstantinos

* latest changes

* Eirini's change,name of mist0 to match_to_single_star

* making lists for each matching

* changes in lambda minimize function to a more general function that can take an arbitrary list

* typo

* added the option of the different list of attributes in the step_merged

* matching should work the same for all subclasses now

* syntax errors prob fixed

* fixing runtime errors in the new files

* some more fixing

* Some print statements

* change the flowchart to not go to sterp_disurpted if one of the events is detached is called

* prints

* typo in flowchart

* Friday's work

* .

* fix init orbit

* disrupted bianry evolves until CC2

* step SN updated to expect a 2nd CC in an already disrupted system. Matching for postMS and maybe HeStars may still need work

* matching fixing

* slightly improved the verbose text of the matching

* print errors

* changes to match_to_single_star

* generalized alternative matching

* for this PR, step merged does nothing

* matching happening only when needed (once)

* step merged and intially single go to step end for now

* testing cases of ZAMS stars not needed to match

* binary fraction

* minor changes in isolated or initially single

* else statement, self.companion

* typo

* deleted the option of fidning ZAMS through logR

* syntax error fixing

* resolving merging issues

* went back to grid_Hrich and grid_strippedHe

* ini file

* ini

* surf_avg_omega_div_omega_crit is not always stored, so it is no longer called for and passed to solve_ivp. It is calculated in the Matt+2015 magnetic braking calculation from stellar properties now, as it is only needed there.

* del grid from detached params

* ini

* Removed additional instances where interp1d_sec[surf_avg_omega_div_omega_crit](t - t_offset_sec) was called.

* changing the random

* removed superfluous commas in defining detached step properties

* Adding step_isolated,step_disrupted in the STEP_NAMES_LOADING_GRIDS so the metallicity can propagate in ther kwargs

* fix in ini file

* I think I went the POSYDON-MESA-INLIST submodule back

* changed class names according to CamelCase convention

* time profiling

* Corrections to the detached verbose with timestamp.

* no matching for the CO star, using m0,t0 of the previously matched star

* Giving additional option 1 in verbose to print only the matching parameters

* Step 1 in cleaning detached step.

* Step 2 in cleaing detached step.

* Removing duplicate code in square difference function.

* Deciding on which column are going to use relative distance during matching.

* Deleting obsolete transform method in detached step.

* Removing unnecessary transform when scaling columns in detached step.

* Using stored scalers and removing some useless self.grid assignments

* in the 3rd matching step, I added the change of htrack also for postMS stars

* added htrack  = star.htrack

* commenting out the relative differences during matching for center_he4

* in the 3rd alternative matching we also change the parameters used for matching to the ones according to the new htrack

* typo

* htrack is updated outside match_to_single_star to be used in the rest of get_star_data

* removed simulationproperties from CE folder...

---------

Co-authored-by: Eirini Kasdagli <kasdaglie@login6.ufhpc>
Co-authored-by: kasdaglie <kasdaglie@ufl.edu>
Co-authored-by: sg <sethg45@gmail.com>
Co-authored-by: kkovlakas <kkovla@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants