Window Functions¶
-
class
sacc.windows.
BaseWindow
[source]¶ Base class for window functions.
Window functions here are for 1D variables and describe binnings from functions onto discrete values.
They are treated as a special kind of tag value in Sacc.
Subclasses describe common types of window function, including a top hat between two values and a general tabulated functional form.
This base class has class methods that can be used to turn mixed lists of windows to/from astropy tables, for I/O.
Methods
from_tables
(table_list)Turn a list of astropy tables into window objects to_tables
(instance_list)Convert a list of BaseWindos to a list of tables. -
classmethod
from_tables
(table_list)[source]¶ Turn a list of astropy tables into window objects
This is called when loading data from file.
Parameters: - instance_list: list
List of BaseWindow instances
Returns: - windows: dict
Dictionary of id -> Window instances
-
classmethod
to_tables
(instance_list)[source]¶ Convert a list of BaseWindos to a list of tables.
This is called when saving data to file.
The input instances can be different subclasses, and no ordering is maintained.
Parameters: - instance_list: list
List of BaseWindow subclass instances
Returns: - table: list
List of astropy.table.Table instances
-
classmethod
-
class
sacc.windows.
TopHatWindow
(range_min, range_max)[source]¶ A window function that is constant between two values.
The top-hat is zero elsewhere.
In the case of discrete functions like ell window where it matters, these window functions should follow the python convention and the upper limit should be exclusive, so that you can use range(win.min, win.max) to select the right ell values.
Attributes: - min: int/float
The minimum value where the top-hat function equals 1
- max: int/float
The maximum value where the top-hat function equals 1
Methods
from_table
(table)Convert an astropy table to a dictionary of Top-Hat windows from_tables
(table_list)Turn a list of astropy tables into window objects to_tables
(window_list)Convert a list of Top-Hat windows to a list of astropy tables. -
classmethod
from_table
(table)[source]¶ Convert an astropy table to a dictionary of Top-Hat windows
Multiple windows are extracted from the single table.
Parameters: - table: astropy.table.Table
Returns: - windows: dict
Dictionary of id -> TopHatWindow instances
-
classmethod
to_tables
(window_list)[source]¶ Convert a list of Top-Hat windows to a list of astropy tables.
A single table is created for all the windows.
The tables contain an ID column which uniquely identifies the window instance, but only whilst running a given python process - it is not portable. It should not be used for anythng other than I/O.
Parameters: - instance_list: list
List of TopHatWindow instances
Returns: - table: list
List of astropy.table.Table instances
-
class
sacc.windows.
Window
(values, weight)[source]¶ The Window class defines a tabulated window function.
The class contains tabulated values of the abscissa (e.g. ell or theta) and corresponding weights values for each one.
The function could be integrated or summed depending on the context.
Attributes: - values: array
The points at which the weights are defines
- weight:
The weights corresponding to each value
Methods
from_table
(table)Convert an astropy table to a dictionary of Windows from_tables
(table_list)Turn a list of astropy tables into window objects to_tables
(window_list)Convert a list of windows to a list of astropy tables. -
classmethod
from_table
(table)[source]¶ Convert an astropy table to a dictionary of Windows
One window is extracted from the table.
Parameters: - table: astropy.table.Table
Returns: - windows: dict
Dictionary of id -> Window instances
-
classmethod
to_tables
(window_list)[source]¶ Convert a list of windows to a list of astropy tables.
One table is created per window.
The tables contain an ID column which uniquely identifies the window instance, but only whilst running a given python process - it is not portable. It should not be used for anythng other than I/O.
Parameters: - instance_list: list
List of Window instances
Returns: - table: list
List of astropy.table.Table instances