qnm.cached¶
Caching interface to Kerr QNMs
This is a high-level interface to the package. An instance of
KerrSeqCache
will return instances of
qnm.spinsequence.KerrSpinSeq
from memory or disk. If a spin
sequence is neither in memory nor on disk then it will be computed and
returned.
Use download_data()
to fetch a collection of precomputed spin
sequences from the web.
TODO More documentation.
Functions
build_package_default_cache (ksc) |
Compute the standard list of modes that this package promises to have in its cache. |
download_data ([overwrite]) |
Fetch and decompress tarball of precomputed spin sequence from the web. |
load_cached_mode (s, l, m, n) |
Read a KerrSpinSeq from disk. |
mode_pickle_path (s, l, m, n) |
Construct the path to a pickle file for the mode (s, l, m, n) |
write_mode (spin_seq[, pickle_path]) |
Write an instance of KerrSpinSeq to disk. |
Classes
KerrSeqCache ([init_schw, …]) |
TODO |
-
class
qnm.cached.
KerrSeqCache
(init_schw=False, compute_if_not_found=True, compute_pars=None)[source]¶ TODO
Parameters: - init_schw: bool, optional [default: False]
TODO
- compute_if_not_found: bool, optional [default: True]
TODO
- compute_pars: dict, optional [default: None]
TODO
Attributes: - TODO
Methods
__call__
(s, l, m, n[, compute_if_not_found, …])Load a qnm.spinsequence.KerrSpinSeq
from the cache or from disk if available.write_all
()Write all of the modes in the cache to disk. -
__call__
(s, l, m, n, compute_if_not_found=None, compute_pars=None)[source]¶ Load a
qnm.spinsequence.KerrSpinSeq
from the cache or from disk if available.If the mode sequence is not available on disk, optionally compute it from scratch. TODO maybe take param: dict of params to pass to KerrSpinSeq?
Parameters: - s: int
Spin-weight of field of interest.
- l: int
Multipole number of mode. l >= angular.l_min(s, m)
- m: int
Azimuthal number of mode.
- n: int
Overtone number of mode.
- compute_if_not_found: bool, optional [default: self.compute_if_not_found]
Whether or not to compute from scratch the spin sequence if it is not available on disk.
- compute_pars: dict, optional [default: self.compute_pars]
Dict of parameters to pass to KerrSpinSeq if a mode sequence needs to be computed from scratch.
Returns: - KerrSpinSeq
The mode, if it is in the cache, on disk, or has been computed from scratch. If the mode is not available and compute_if_not_found is false, return None.
-
qnm.cached.
build_package_default_cache
(ksc)[source]¶ Compute the standard list of modes that this package promises to have in its cache.
This method is intended to be used for building the modes from scratch in a predictable way. If modes are available on disk then there will be no computation, simply loading all the default modes.
Parameters: - ksc: KerrSeqCache
The cache that will hold the modes we are about to compute.
Returns: - KerrSeqCache
The updated cache.
-
qnm.cached.
download_data
(overwrite=False)[source]¶ Fetch and decompress tarball of precomputed spin sequence from the web.
Parameters: - overwrite: bool, optional [default: False]
If there is already a tarball on disk, this flag controls whether or not it is overwritten.
-
qnm.cached.
load_cached_mode
(s, l, m, n)[source]¶ Read a KerrSpinSeq from disk.
Path is determined by
mode_pickle_path(s, l, m, n)()
.Parameters: - s: int
Spin-weight of field of interest.
- l: int
Multipole number of mode. l >= angular.l_min(s, m)
- m: int
Azimuthal number of mode.
- n: int
Overtone number of mode.
Returns: - KerrSpinSeq
The mode, if it exists. Otherwise None.
-
qnm.cached.
mode_pickle_path
(s, l, m, n)[source]¶ Construct the path to a pickle file for the mode (s, l, m, n)
Parameters: - s: int
Spin-weight of field of interest.
- l: int
Multipole number of mode. l >= angular.l_min(s, m)
- m: int
Azimuthal number of mode.
- n: int
Overtone number of mode.
Returns: - string
<dirname of this file>/data/s<s>_l<l>_m<m>_n<n>.pickle
-
qnm.cached.
write_mode
(spin_seq, pickle_path=None)[source]¶ Write an instance of KerrSpinSeq to disk.
Parameters: - spin_seq: KerrSpinSeq
The mode to write to disk.
- pickle_path: string, optional [default: None]
Path to file to write. If None, get the path from
mode_pickle_path()
.
Raises: - TODO