Simulation properties for the population class.

This class contains the simulation properties, e.g. flow, steps and max_time.

class posydon.binary_evol.simulationproperties.EvolveHooks[source]

Bases: object

Base class for hooking into binary evolution.

post_evolve(binary)[source]

Perform actions after a binary exits the evolution loop.

post_step(binary, step_name)[source]

Perform acctions after every evolution step.

pre_evolve(binary)[source]

Perform actions before a binary evolves.

pre_step(binary, step_name)[source]

Perform actions before every evolution step.

class posydon.binary_evol.simulationproperties.PrintStepInfoHooks[source]

Bases: posydon.binary_evol.simulationproperties.EvolveHooks

Simple example for adding extra print info.

post_evolve(binary)[source]

Report at the end of the evolution of each binary.

pre_step(binary, step_name)[source]

Print the step name for each binary, before taking it.

class posydon.binary_evol.simulationproperties.SimulationProperties(properties=None, **kwargs)[source]

Bases: object

Class describing the properties of a population synthesis simulation.

Construct the simulation properties object.

Parameters
  • properties (object) – Simulation Properties class containing, e.g. flow, steps.

  • extra_hooks (list of tuples) – Each tuple contains a hooks class and kwargs or the extra step name (‘extra_pre_evolve’, ‘extra_pre_step’, ‘extra_post_step’, ‘extra_post_evolve’) and the corresponding function.

close()[source]

Close hdf5 files before exiting.

load_steps(verbose=False)[source]

Instantiate step classes and set as instance attributes.

Parameters

verbose (bool) – Print extra information.

Returns

Return type

None

post_evolve(binary)[source]

Finalize the evolution of the binary.

The method is called after a binary exits the evolution loop. Uses all extra hooks classes or extra functions.

Parameters

binary (instance of <class, BinaryStar>) – The binary after evolution is ended.

Returns

binary

Return type

instance of <class, BinaryStar>

post_step(binary, step_name)[source]

Finalize step.

The method is called after every evolution step; uses all extra hooks classes or extra functions (except for undefined next step errors).

Parameters
  • binary (instance of <class, BinaryStar>) – The binary before evolution starts.

  • step_name (str) – The name of the step about to be called (as defined in the flow).

Returns

binary

Return type

instance of <class, BinaryStar>

pre_evolve(binary)[source]

Functions called before a binary evolves.

Uses all extra hooks classes or extra functions.

Parameters

binary (instance of <class, BinaryStar>) – The binary before evolution starts.

Returns

binary

Return type

instance of <class, BinaryStar>

pre_step(binary, step_name)[source]

Prepare for step.

The method is called before every evolution step; uses all extra hooks classes or extra functions (except for undefined next step errors).

Parameters
  • binary (instance of <class, BinaryStar>) – The binary before evolution starts.

  • step_name (str) – The name of the step about to be called (as defined in the flow).

Returns

binary

Return type

instance of <class, BinaryStar>

class posydon.binary_evol.simulationproperties.StepNamesHooks[source]

Bases: posydon.binary_evol.simulationproperties.EvolveHooks

Add history column ‘step_name’ to each binary.

Name of evolutionary step as defined in SimulationProperties.

>>> pop.to_df(extra_columns=['step_names'])
post_evolve(binary)[source]

Ensure None’s are append to step_names to match rows in history.

post_step(binary, step_name)[source]

Record the step name.

pre_evolve(binary)[source]

Initialize the step name to match history.

pre_step(binary, step_name)[source]

Do not do anything before the step.

class posydon.binary_evol.simulationproperties.TimingHooks[source]

Bases: posydon.binary_evol.simulationproperties.EvolveHooks

Add history column ‘step_times’ (time taken by step) to each binary.

Example

>>> pop.to_df(extra_columns=['step_times'])
post_evolve(binary)[source]

Add None’s to step_times to match history rows.

post_step(binary, step_name)[source]

Record the duration of the step.

pre_evolve(binary)[source]

Initialize the step time to match history.

pre_step(binary, step_name)[source]

Record the wall time before taking the step.