Skip to content

Commit

Permalink
add noise
Browse files Browse the repository at this point in the history
  • Loading branch information
profxj committed Mar 11, 2016
1 parent 1a22dbc commit 70ad923
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion linetools/spectra/xspectrum1d.py
Expand Up @@ -362,12 +362,13 @@ def add_noise(self, seed=None, s2n=None):

# Modify the flux
if s2n is not None:
sig = 1. / s2n
sig = np.ones_like(self.flux) / s2n
else:
sig = self.sig.value
# Copy
newspec = self.copy()
newspec.data['flux'][self.select] = self.flux.value + (rand * sig)
newspec.data['sig'][self.select] = sig
#
return newspec

Expand Down

0 comments on commit 70ad923

Please sign in to comment.