Convolution

This module contains various convolution functionality specifically suited to work with provided convolutional objects.

lfd.analysis.profiles.convolution.largest_common_scale(*args)[source]

Finds the new appropriate common scale between given objects such that the new boundaries start at the leftmost and end at the rightmost object and the step between two points is the smallest step value for all objects.

It is very important that the scale of the two convolved functions is the same! F.e. convolving a functions with scale lengths of 1 arcsecond and 1 degree is drastically different than convolving functions with the same scale length.

Parameters:*args (list, tuple) – set of objects we wish to reduce to the largest common scale

Example

>>> newscale = largest_common_scale(obj1, obj2, obj3, ...)
lfd.analysis.profiles.convolution.convolve_seeing(obj, seeing, name='seeing-convolved')[source]

Rescales, normalizes and convolves object and seeing.

Parameters:
  • obj (lfd.analysis.profile.ConvolutionObject) – brightness profile of object to be convolved
  • obj2 (lfd.analysis.profile.ConvolutionObject) – seeing profile that will be convolved with object
  • name (str) – ConvolutionObjects can be assigned names, or will default to an appropriate name based on instantiation, which helps with tracking the current object status and with plotting.
lfd.analysis.profiles.convolution.convolve_defocus(obj, defocus, name='defocus-convolved')[source]

Rescales, normalizes and convolves object and defocus.

Parameters:
  • obj (lfd.analysis.profile.ConvolutionObject) – brightness profile of object to be convolved
  • defocus (lfd.analysis.profile.ConvolutionObject) – defocus profile that will be convolved with object
  • name (str) – ConvolutionObjects can be assigned names, or will default to an appropriate name based on instantiation, which helps with tracking the current object status and with plotting.
lfd.analysis.profiles.convolution.convolve_seeing_defocus(obj, seeing, defocus, name='seeing-defocus-convolved')[source]

Rescales, normalizes and then convolves object, seeing and defocus.

Parameters:
  • obj (lfd.analysis.profile.ConvolutionObject) – brightness profile of object to be convolved
  • defocus (lfd.analysis.profile.ConvolutionObject) – defocus profile that will be convolved with object
  • seeing (lfd.analysis.profile.ConvolutionObject) – seeing profile that will be convolved with the previous convolution result
  • name (str) – ConvolutionObjects can be assigned names, or will default to an appropriate name based on instantiation, which helps with tracking the current object status and with plotting.
lfd.analysis.profiles.convolution.convolve(*args, name=None)[source]

Rescales, normalizes and convolves the provided ConvolutionObjects. Functionality applied in convolve_seeing/defocus or convolve_seeing_defocus functions is used when two or three ConvolutionObjects are provided. Otherwise the convolution is performed recursively which can be slow.

Parameters:
  • *args (tuple, list) – set of objects that will be convolved
  • name (str) – ConvolutionObjects can be assigned names, or will default to an appropriate name based on instantiation, which helps with tracking the current object status and with plotting. If left None will default to “convolved”

Example

>>> convolve(obj, seeing, defocus)
class lfd.analysis.profiles.convolutionobj.ConvolutionObject(obj, scale, name=None)[source]

Represents an object that can be convolved with other ConvolutionObjects or functions. Practical because the objects can be created with or without knowing their analytical expressions. ConvolutionObject can be instantiated from two arrays - scale and obj. Scale represents the “x-axis” and the obj array the function value at some x-coordinate. The function is then constructed by interpolating between the obj points. If an object’s analytical light-curve is known then user can override the method ‘f’ such that it returns the value of the analytical expression at a given coordinate.

obj

brightness values of the object, its profile

Type:list, tuple or np.array
scale

the “x” coordinates against which obj was evaluated, note that objects “center” (central maximal value) is generally centered on the 0 of the scale

Type:list, tuple or np.array
__guessf

the function used for interpolation in case analytical form is unknown

Type:np.interp1d
scaleleft

leftmost points of the scale

Type:float
scaleright

rightmost points of the scale

Type:float
objleft

rightmost points at which obj>0

Type:float
objright

rightmost points at which obj>0

Type:float
step

the difference between two scale points (fineness of the coordinates)

Type:float
name

by default assigned to the class name instantiating this object. Useful to keep track of the function it represents but also for plotting.

Type:str
Parameters:
  • obj (list, tuple or np.array) – brightness values of the object, its profile
  • scale (list, tuple or np.array) – the “x” coordinates against which obj was evaluated, note that objects “center” (central maximal value) is generally centered on the 0 of the scale
calc_fwhm()[source]

Calculates Full-Width-Half-Maximum of the object.

f(r=None)[source]

Returns the value of the profile function at a point/array of points r. If analytical expression is not know interpolation between nearest points is attempted. If this occurs a warning is raised.

classmethod fromConvolution(obj, scale, name=None)[source]

From given arrays obj and scale create a ConvolutionObject.

norm()[source]

Renormalizes values so that maximal value is 1.

rescale(x, y=None, step=None)[source]

Given a scale x recalculate the brightness values of obj over the new points. If only x and y are supplied, then a new scale is created with the new boundaries [x, y> and previously used step If x, y and step are provided then a new scale is created with new boundaries [x, y> where the distance between two points equals to step.

update()[source]

Check and update the scale left and rightmost points. Find the first and last coordinate at which object is still brighter than 0. Recalcualtes step.