Commit 25abccd9 authored by Theo Steininger's avatar Theo Steininger

Added create_power_operator in sugar.py

parent 5238f400
# -*- coding: utf-8 -*-
from nifty import PowerSpace,\
Field,\
DiagonalOperator,\
FFTOperator
__all__ = ['create_power_operator']
def create_power_operator(domain, power_spectrum, distribution_strategy='not'):
if not domain.harmonic:
fft = FFTOperator(domain)
domain = fft.target[0]
power_domain = PowerSpace(domain)
fp = Field(power_domain,
val=power_spectrum,
distribution_strategy=distribution_strategy)
f = fp.power_synthesize(mean=1, std=0)
power_operator = DiagonalOperator(domain, diagonal=f)
return power_operator
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment