Skip to content
Snippets Groups Projects
Commit 25abccd9 authored by theos's avatar theos
Browse files

Added create_power_operator in sugar.py

parent 5238f400
No related branches found
No related tags found
No related merge requests found
# -*- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment