flip.utils ========== .. py:module:: flip.utils Attributes ---------- .. autoapisummary:: flip.utils._C_LIGHT_KMS_ flip.utils._logging_handler Classes ------- .. autoapisummary:: flip.utils.Logger Functions --------- .. autoapisummary:: flip.utils.Du flip.utils.radec2cart flip.utils.cart2radec flip.utils.return_key flip.utils.create_log Module Contents --------------- .. py:data:: _C_LIGHT_KMS_ .. py:function:: Du(k, sigmau) .. py:function:: radec2cart(rcom, ra, dec) The radec2cart function takes in the comoving distance to a galaxy, its right ascension and declination, and returns the x, y, z coordinates of that galaxy. :param rcom: Convert the ra and dec to cartesian coordinates :param ra: Calculate the x-coordinate of a point in space :param dec: Calculate the z coordinate :returns: The x, y and z coordinates of each galaxy .. py:function:: cart2radec(x, y, z) The cart2radec function converts cartesian coordinates to spherical coordinates. The input is a set of x, y, and z values. The output is the radius (rcom), right ascension (ra), and declination (dec). :param x: Represent the x-coordinate of a point in space :param y: Calculate the right ascension :param z: Calculate the declination :returns: The radius, right ascension and declination of a point in cartesian coordinates .. py:function:: return_key(dictionary, string, default_value) The return_key function takes a dictionary, a string, and a default value. It returns the value of the key in the dictionary that matches the string if it exists. If not, it returns the default_value. :param dictionary: Pass in a dictionary to the function :param string: Specify the key to look up in the dictionary :param default_value: Return a default value if the key is not in the dictionary :returns: A value from a dictionary .. py:function:: create_log(log_level='info') The create_log function creates a logger object that can be used to log messages. The function takes one argument, the log_level, which is set to "info" by default. The function returns a Logger object with the specified logging level. :param log_level: Set the logging level :returns: A logger object .. py:data:: _logging_handler :value: None .. py:class:: Logger(name='Python_Report', log_level='info') Bases: :py:obj:`object` .. py:method:: setup_logging() The setup_logging function is used to set up the logging module. :param self: Refer to the current instance of a class :returns: Nothing .. py:method:: setup_report_logging() The setup_report_logging function is used to set up the logging for a report. :param self: Represent the instance of the class :returns: None .. py:method:: add(line, level='info') :staticmethod: The add function takes a line of text and adds it to the log file. It also takes an optional level argument, which can be set to "info", "warning" or "debug". If no level is specified, the default value is used ("info"). :param line: Pass the line of text to be logged :param level: Determine the type of log message :returns: None .. py:method:: add_array_statistics(arr, char) :staticmethod: The add_array_statistics function takes in an array and a character, and prints out the min, max, mean, and standard deviation of that array. :param arr: Store the array that is passed to the function :param char: Specify which array is being used :returns: The minimum, maximum, mean and standard deviation of the array .. py:method:: close() :staticmethod: The close function shuts down the logging module. Args: :returns: The return value of the logging