synthpop ======== .. py:module:: synthpop .. autoapi-nested-parse:: make Synthpop available for import Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/synthpop/__main__/index /autoapi/synthpop/constants/index /autoapi/synthpop/migrate_interactive_part/index /autoapi/synthpop/modules/index /autoapi/synthpop/population/index /autoapi/synthpop/position/index /autoapi/synthpop/star_generator/index /autoapi/synthpop/synthpop_main/index /autoapi/synthpop/synthpop_utils/index /autoapi/synthpop/undo_migrate_interactive_part/index Attributes ---------- .. autoapisummary:: synthpop.SYNTHPOP_DIR Classes ------- .. autoapisummary:: synthpop.SynthPop Functions --------- .. autoapisummary:: synthpop.main Package Contents ---------------- .. py:data:: SYNTHPOP_DIR :value: b'.' .. py:class:: SynthPop(*args, **kwargs) Model class for generating catalogs of stars. Attributes ---------- model_name : str name of the model directory population_files : list list of population.json files detected in the model directory population : list list of the initialized population objects solid_angle : float [sr] size of the cone min_mass, max_mass : float [Msun] minimum and maximum mass of the Star generation filename_base : str file name to store the results including the path and without an extension Methods ------- __init__() : None initialize the SynthPop class init_populations() : None collects the population configuration and initializes the populations update_location(l_deg: float, b_deg: float, solid_angle_sr: float) : None wrapper to update the location in all the populations estimate_field_population() : None wrapper to estimate the field output for each population do_kinematics(field_df: pandas.DataFrame) : pandas.DataFrame wrapper to call the kinematics generation in each population generate_fields() : None wrapper to generate all the populations write_astrotable(filename: str, df: pandas.DataFrame, extension: str) : None option to save the table as fits or VoTable. write_to_file(df: pandas.DataFrame) : str save the generated model, returns the filename get_filename(l_deg: float, b_deg: float, solid_angle_sr: float) : None generate the base of the filename (i.e. without extension) for a given location process_location(l_deg: float, b_deg: float, solid_angle_sr: float, save_data: bool) : Pandas.DataFrame Dict process a given location. process_all() : None process all locations as specified in the configuration .. py:attribute:: parms .. py:attribute:: population_files :value: None .. py:attribute:: populations :value: [] .. py:attribute:: filename_base :value: None .. py:attribute:: populations_are_initialized :value: False .. py:attribute:: save_data :value: True .. py:attribute:: l_deg :value: None .. py:attribute:: b_deg :value: None .. py:attribute:: solid_angle :value: None .. py:attribute:: solid_angle_unit :value: None .. py:method:: get_iter_loc() -> Iterator[Tuple[float, float]] returns an iterator for the defined locations .. py:method:: init_populations(forced: bool = False) -> None Wrapper function that initializes all the populations for the model. Can initialize with coordinates, but it is not necessary. Parameters ---------- forced : bool forced the initialisation, even if the populations are initialized before Returns ------- .. py:method:: update_location(l_deg: float, b_deg: float, solid_angle: float, solid_angle_unit: str = 'deg^2', **positional_kwargs) -> None Simple wrapper to update filename, logfile, and all populations in the model to the new location (l,b) and solid angle. Parameters ---------- l_deg : float ['deg'] galactic longitude for the center of the cone b_deg : float ['deg'] galactic longitude for the center of the cone solid_angle : float [deg^2] steradians for the cone size solid_angle_unit : str unit for steradians positional_kwargs : any keyword to be passed to Position .. py:method:: estimate_field_population() -> None A simple wrapper to estimate the total mass and number of stars to be drawn in a field .. py:method:: do_kinematics(field_df: pandas.DataFrame) -> pandas.DataFrame A simple wrapper to call the kinematic generation of each population Note that the change is performed in place. I.e. It will overwrite what the kinematics in field_df is Parameters ---------- field_df : DataFrame Generated stars Returns ------- field_df dataframe of the generated stars .. py:method:: generate_fields() -> Tuple[pandas.DataFrame, Dict] calls the generate_field for all the populations and collects the data in a common pandas dataframe. Returns ------- field_df: DataFrame DataFrame including the generated Stars from all populations distributions: dict collection of intrinsic distributions for each population .. py:method:: write_astrotable(filename: str, df: pandas.DataFrame, extension: str) -> None save the result as fits file or votable by converting it to an astropy.table.Table object. Parameters ---------- filename : str save location df : DataFrame Data frame of the generated model extension : str file extension. either "fits" or "vot"/"votable" Returns ------- .. py:method:: write_to_file(df: pandas.DataFrame) -> str write the results to disc Parameters ---------- df : DataFrame Model output Returns ------- filename : str path of the created file save location. .. py:method:: get_filename(l_deg: float, b_deg: float, solid_angle: float) -> str create a file name for a given position Parameters ---------- l_deg, b_deg : float [deg] galactic coordinates solid_angle: float [rad] solid angle of the cone Returns ------- filename : str filename including location .. py:method:: process_location(l_deg: float, b_deg: float, solid_angle: float, solid_angle_unit: str = 'deg^2', save_data: bool = True) -> Tuple[pandas.DataFrame, Dict] Performs the field generation for a given position. Parameters ---------- l_deg, b_deg : float [deg] galactic coordinates solid_angle : float [deg^2] Area of the cone solid_angle_unit : str Unit of the provided solid_angle save_data : bool If True the DataFrame is saved to disk If False the DataFrame are only returned, Returns ------- field_df : DataFrame Generated stars as Pandas Dataframe distributions: dict collection of intrinsic distributions for each population .. py:method:: process_all(forced=False) -> None Calls the Initialization of all populations and calls the process for all given locations. .. py:function:: main(configfile: str = None, **kwargs) Run Synthpop in the standard mode