Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #21 from zonca/add_component
Browse files Browse the repository at this point in the history
Make it easier to add a custom emission
  • Loading branch information
Ben Thorne authored Mar 12, 2018
2 parents 0883c51 + 9e2fcf2 commit b3e23bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 14 additions & 0 deletions pysm/pysm.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ def signal(nu):
return sig
return signal

def add_component(self, name, component):
"""Add a already initialized component object to the sky
Parameters
==========
name : str
name of the new component, it cannot include spaces or commas
component : object
object that provides a signal(nu, **kwargs) function that returns the emission in uK_RJ
"""
self.__components.append(name)
setattr(self, name, component.signal)


class Instrument(object):
"""This class contains the attributes and methods required to model
the instrument observing Sky.
Expand Down
5 changes: 4 additions & 1 deletion pysm/test/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
from pysm import components, common, read_map, convert_units
from pysm import get_template_dir

from astropy.analytic_functions import blackbody_nu
try:
from astropy.analytic_functions import blackbody_nu
except ImportError:
from astropy.modeling.blackbody import blackbody_nu
import numpy as np, healpy as hp
import matplotlib.pyplot as plt
import scipy.constants as constants
Expand Down

0 comments on commit b3e23bb

Please sign in to comment.