synthpop.synthpop_utils ======================= .. py:module:: synthpop.synthpop_utils Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/synthpop/synthpop_utils/coordinates_transformation/index /autoapi/synthpop/synthpop_utils/get_subclass/index /autoapi/synthpop/synthpop_utils/json_loader/index /autoapi/synthpop/synthpop_utils/pydantic_1_compatibility/index /autoapi/synthpop/synthpop_utils/sun_info/index /autoapi/synthpop/synthpop_utils/synthpop_control/index /autoapi/synthpop/synthpop_utils/synthpop_logging/index /autoapi/synthpop/synthpop_utils/utils_functions/index Attributes ---------- .. autoapisummary:: synthpop.synthpop_utils.get_subclass synthpop.synthpop_utils.default_sun Classes ------- .. autoapisummary:: synthpop.synthpop_utils.Parameters synthpop.synthpop_utils.PopParams synthpop.synthpop_utils.ModuleKwargs synthpop.synthpop_utils.SunInfo Functions --------- .. autoapisummary:: synthpop.synthpop_utils.solidangle_to_half_cone_angle synthpop.synthpop_utils.half_cone_angle_to_solidangle synthpop.synthpop_utils.rotation_matrix synthpop.synthpop_utils.json_loader synthpop.synthpop_utils.log_basic_statistics synthpop.synthpop_utils.parser Package Contents ---------------- .. py:function:: solidangle_to_half_cone_angle(solid_angle) .. py:function:: half_cone_angle_to_solidangle(cone_angle) .. py:function:: 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_matrix : np.ndarray rotation matrix .. py:data:: get_subclass .. py:function:: json_loader(filename, json_file_branch=None) Custom JSON loader that removes comments, substitutes filenames. Parameters ---------- filename : str filename of the json file implemented json_file_branch : list used to detect recursions Returns ------- data: dictionary loaded json file with removes comments, substitutes filenames. .. py:function:: log_basic_statistics(df, var_name, criteria=None) .. py:function:: parser() -> argparse.Namespace synthpop control and help interface .. py:class:: 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 .. py:attribute:: l_set :value: None .. py:attribute:: l_set_type :value: None .. py:attribute:: b_set :value: None .. py:attribute:: b_set_type :value: None .. py:attribute:: _categories .. py:attribute:: loc .. py:attribute:: model_dir .. py:attribute:: sun .. py:attribute:: extinction_map_kwargs .. py:method:: validate_mandatory_input() checks if all Mandatory files are provided .. py:method:: 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 .. py:method:: rest_loc_iterator() .. py:method:: log_settings() log the settings as json formatted file .. py:method:: 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. .. py:method:: 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 .. py:method:: read_kwargs_config(kwargs: dict) reads settings from keyword arguments Parameters ---------- kwargs: dict dictionary of specifications .. py:class:: PopParams Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: name :type: str .. py:attribute:: imf_func_kwargs :type: ModuleKwargs .. py:attribute:: age_func_kwargs :type: ModuleKwargs .. py:attribute:: metallicity_func_kwargs :type: ModuleKwargs .. py:attribute:: population_density_kwargs :type: ModuleKwargs .. py:attribute:: kinematics_func_kwargs :type: ModuleKwargs .. py:attribute:: evolution_kwargs :type: Optional[Union[ModuleKwargs, List[ModuleKwargs]]] :value: None .. py:attribute:: av_mass_corr :type: Optional[float] :value: None .. py:attribute:: n_star_corr :type: Optional[float] :value: None .. py:method:: parse_jsonfile(filename) :classmethod: .. py:class:: ModuleKwargs Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: name :type: Optional[str] :value: '' .. py:attribute:: filename :type: Optional[str] :value: '' .. py:method:: validate_filename(values) :classmethod: .. py:property:: init_kwargs .. py:class:: SunInfo Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: x :type: float :value: -8.178 .. py:attribute:: y :type: float :value: 0.0 .. py:attribute:: z :type: float :value: 0.017 .. py:attribute:: u :type: float :value: 12.9 .. py:attribute:: v :type: float :value: 245.6 .. py:attribute:: w :type: float :value: 7.78 .. py:attribute:: u_lsr :type: float :value: 1.8 .. py:attribute:: v_lsr :type: float :value: 233.4 .. py:attribute:: w_lsr :type: float :value: 0.53 .. py:attribute:: l_apex_deg :type: float :value: 53.0 .. py:attribute:: b_apex_deg :type: float :value: 25.0 .. py:class:: Config .. py:attribute:: keep_untouched .. py:property:: gal_dist :type: float .. py:property:: r :type: float .. py:property:: theta :type: float .. py:property:: cos_theta :type: float .. py:property:: sin_theta :type: float .. py:property:: v_pec :type: float .. py:data:: default_sun