Skip to content

Commit

Permalink
Fix PEP8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yeganer committed Jun 6, 2017
1 parent 6cd9bdb commit ae46cc3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions tardis/montecarlo/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,25 @@ def f_nu_to_f_lambda(self, f_nu):
def plot(self, ax, mode='wavelength'):
if mode == 'wavelength':
ax.plot(self.wavelength.value, self.flux_lambda.value)
ax.set_xlabel('Wavelength [%s]' % self.wavelength.unit._repr_latex_())
ax.set_xlabel('Wavelength [{}]'.format(
self.wavelength.unit._repr_latex_())
)
ax.set_ylabel('Flux [%s]' % self.flux_lambda.unit._repr_latex_())

def to_ascii(self, fname, mode='luminosity_density'):
if mode == 'luminosity_density':
np.savetxt(fname, zip(self.wavelength.value, self.luminosity_density_lambda.value))
np.savetxt(
fname, zip(
self.wavelength.value,
self.luminosity_density_lambda.value))
elif mode == 'flux':
np.savetxt(
fname,
zip(self.wavelength.value, self.flux_lambda.value))
else:
raise NotImplementedError('only mode "luminosity_density" and "flux" are implemented')
raise NotImplementedError(
'only mode "luminosity_density"'
'and "flux" are implemented')

def to_hdf(self, path_or_buf, path):
pass
Expand Down
2 changes: 1 addition & 1 deletion tardis/montecarlo/tests/test_spectrum.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import pytest
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -189,6 +188,7 @@ def test_to_from_hdf_buffer(tmpdir, spectrum):
spectrum,
spec_from)


def test_creat_from_wl(spectrum):
actual = TARDISSpectrum(
spectrum._frequency.to('angstrom', u.spectral()),
Expand Down

0 comments on commit ae46cc3

Please sign in to comment.