Skip to content

Create a general smearing morph #211

Description

@Sparks29032

Problem

Generalize the smear morph to not just Gaussians.

Solution

Let's add an option --smear-function or something that can be either a word (e.g. "gaussian", "lorentzian", etc.) or a function in the case of the Python API.

To implement the arbitrary function:

  • Check that the user is imputing the function from the Python API only (morphpy.py). This should be fairly easy since the CLI input will be a string, while the Python function will be an actual function. Check for edge chases (e.g. if a user somehow can input a non-string in the CLI as input.)
  • Check if the input is a string or function. If it is a string, then run the code as usual. If it is a function, set the smearing function to be the user-passed function.
  • Check that the user-provided function is normalizable. E.g. the L1 or L2 norm is bounded. This is important as we normalize by the L1 norm of the function. I'm actually not too sure this is necessary as we normalize by the sum of the function over the xmin to xmax range the user provides, meaning divergences at infinity are not a concern, but it is still something to think about. We ABSOLUTELY need to ensure the function is well-defined in all points between xmin and xmax though.
  • Ensure self-consistency. If the program returns +/-sigma, make sure reading in +/-sigma do the same thing. (E.g. for the Lorentzian, +/-sigma/((r-r_0)2+sigma2) are not the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions