synthpop.synthpop_utils

Submodules

Attributes

get_subclass

default_sun

Classes

Parameters

NameSpace object to store the configuration parameters

PopParams

ModuleKwargs

SunInfo

Functions

solidangle_to_half_cone_angle(solid_angle)

half_cone_angle_to_solidangle(cone_angle)

rotation_matrix(→ numpy.ndarray)

creates the rotation matrix along a given axis.

json_loader(filename[, json_file_branch])

Custom JSON loader that removes comments, substitutes filenames.

log_basic_statistics(df, var_name[, criteria])

parser(→ argparse.Namespace)

synthpop control and help interface

Package Contents

synthpop.synthpop_utils.solidangle_to_half_cone_angle(solid_angle)
synthpop.synthpop_utils.half_cone_angle_to_solidangle(cone_angle)
synthpop.synthpop_utils.rotation_matrix(theta_rad: float or np.ndarray or None = None, st: float or np.ndarray or None = None, ct: float or np.ndarray or None = None, axis: str = '') numpy.ndarray

creates the rotation matrix along a given axis. These are:

1 0 0 |
RX = | 0 cos -sin |
0 sin cos |
cos 0 -sin |
RY = | 0 1 0 |
sin 0 cos |
cos -sin 0 |
RZ = | sin cos 0 |
0 0 1 |

Parameters

theta_rad: float or np.ndarray or None [rad]

rotation angle

st, ct: float or np.ndarray or None [rad]

sin(theta) and cos(theta)

axis: str

string to specify the axis. either ‘x’, ‘y’, or ‘z’

Returns

rot_matrixnp.ndarray

rotation matrix

synthpop.synthpop_utils.get_subclass
synthpop.synthpop_utils.json_loader(filename, json_file_branch=None)

Custom JSON loader that removes comments, substitutes filenames.

Parameters

filenamestr

filename of the json file implemented

json_file_branchlist

used to detect recursions

Returns

data: dictionary

loaded json file with removes comments, substitutes filenames.

synthpop.synthpop_utils.log_basic_statistics(df, var_name, criteria=None)
synthpop.synthpop_utils.parser() argparse.Namespace

synthpop control and help interface

class synthpop.synthpop_utils.Parameters(specific_config: str or None = None, default_config: str = DEFAULT_CONFIG_FILE, model_dir: str = DEFAULT_MODEL_DIR, **kwargs)

NameSpace object to store the configuration parameters defined by keyword arguments, and in the configuration files

l_set = None
l_set_type = None
b_set = None
b_set_type = None
_categories
loc
model_dir
sun
extinction_map_kwargs
validate_mandatory_input()

checks if all Mandatory files are provided

location_generator() Iterator[Tuple[float, float]]

converts l_set and b_set into a location generator object as defined by the l/b_set_type

rest_loc_iterator()
log_settings()

log the settings as json formatted file

read_default_config(default_config_file: str)

reads settings from keyword arguments

Parameters

default_config_file: str

file and path of the default configuration file

Return

config_dir: str

directory of default_config_file.

read_specific_config(config_file: str or None, config_dir: str = '.')

reads settings from keyword arguments Parameters ———- config_file: str

file and path of the configuration file

config_dir: str

directory where config files can be found

read_kwargs_config(kwargs: dict)

reads settings from keyword arguments

Parameters

kwargs: dict

dictionary of specifications

class synthpop.synthpop_utils.PopParams

Bases: pydantic.BaseModel

name: str
imf_func_kwargs: ModuleKwargs
age_func_kwargs: ModuleKwargs
metallicity_func_kwargs: ModuleKwargs
population_density_kwargs: ModuleKwargs
kinematics_func_kwargs: ModuleKwargs
evolution_kwargs: ModuleKwargs | List[ModuleKwargs] | None = None
av_mass_corr: float | None = None
n_star_corr: float | None = None
classmethod parse_jsonfile(filename)
class synthpop.synthpop_utils.ModuleKwargs

Bases: pydantic.BaseModel

name: str | None = ''
filename: str | None = ''
classmethod validate_filename(values)
property init_kwargs
class synthpop.synthpop_utils.SunInfo

Bases: pydantic.BaseModel

x: float = -8.178
y: float = 0.0
z: float = 0.017
u: float = 12.9
v: float = 245.6
w: float = 7.78
u_lsr: float = 1.8
v_lsr: float = 233.4
w_lsr: float = 0.53
l_apex_deg: float = 53.0
b_apex_deg: float = 25.0
class Config
keep_untouched
property gal_dist: float
property r: float
property theta: float
property cos_theta: float
property sin_theta: float
property v_pec: float
synthpop.synthpop_utils.default_sun