From e425daa0917abcc14cf7a59b70bcedf3c781c713 Mon Sep 17 00:00:00 2001
From: madsmpedersen <m@madsp.dk>
Date: Mon, 21 Dec 2015 09:46:02 +0100
Subject: [PATCH] bug fixes

---
 .gitignore                    |  1 +
 setup.cfg                     |  8 ++++----
 tests/testsuite.py            |  2 --
 wetb/dlc/high_level.py        |  2 +-
 wetb/hawc2/htc_file.py        |  2 +-
 wetb/wind/tests/test_Shear.py | 18 +++++++++---------
 6 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/.gitignore b/.gitignore
index adc083f..9b30bae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ doctrees
 /wetb/dlc/tests/test_files/res_all
 /wetb/dlc/tests/test_files/res2_all
 /wetb/hawc2/ascii2bin/ascii2bin_dist
+/wetb/hawc2/tests/test_files/htcfiles/tmp.htc
diff --git a/setup.cfg b/setup.cfg
index 40b32de..aa1d709 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -51,16 +51,16 @@ packages =
 
 [test]
 # py.test options when running `python setup.py test`
-addopts = tests
+#addopts = tests
 
 [pytest]
 # Options for py.test:
 # Specify command line options as you would do when invoking py.test directly.
 # e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
 # in order to write a coverage file that can be read by Jenkins.
-addopts =
-    --cov wetb --cov-report term-missing
-    --verbose
+#addopts =
+#    --cov wetb --cov-report term-missing
+#    --verbose
 
 [aliases]
 docs = build_sphinx
diff --git a/tests/testsuite.py b/tests/testsuite.py
index e833720..614b76c 100644
--- a/tests/testsuite.py
+++ b/tests/testsuite.py
@@ -2,8 +2,6 @@ import glob
 import unittest
 import os
 
-os.environ['QT_API'] = "pyqt"
-
 def module_strings():
     test_file_paths = glob.glob('test_*.py')
     #test_file_strings.extend(glob.glob('../wetb/**/test_*.py'))
diff --git a/wetb/dlc/high_level.py b/wetb/dlc/high_level.py
index df8c5eb..de50290 100644
--- a/wetb/dlc/high_level.py
+++ b/wetb/dlc/high_level.py
@@ -76,7 +76,7 @@ class DLCHighLevel(object):
                     self.dlc_df.columns = columns
                 else:
                     raise e
-            self.dlc_df[vk] = [str(n).lower().replace(vk, "") for n in self.dlc_df[vk]]
+            self.dlc_df[vk].values[:] = [str(n).lower().replace(vk, "") for n in self.dlc_df[vk]]
         if 'psf' not in self.dlc_df:
             self.dlc_df['psf'] = 1
 
diff --git a/wetb/hawc2/htc_file.py b/wetb/hawc2/htc_file.py
index d875d1e..9d432fd 100644
--- a/wetb/hawc2/htc_file.py
+++ b/wetb/hawc2/htc_file.py
@@ -66,7 +66,7 @@ class HTCFile(HTCContents, HTCDefaults):
         self.contents[key] = value
 
     def __str__(self):
-        return "\n".join(self.initial_comments) + "\n" + "".join([c.__str__(1) for c in self])
+        return "".join(self.initial_comments + [c.__str__(1) for c in self])
 
     def save(self, filename=None):
         if filename is None:
diff --git a/wetb/wind/tests/test_Shear.py b/wetb/wind/tests/test_Shear.py
index 1e26306..981d4ac 100644
--- a/wetb/wind/tests/test_Shear.py
+++ b/wetb/wind/tests/test_Shear.py
@@ -8,7 +8,7 @@ from wetb.utils.geometry import xyz2uvw
 import wetb.gtsdf
 from wetb.wind.shear import power_shear, fit_power_shear, fit_power_shear_ref, \
     log_shear, fit_log_shear, stability_term
-from pylab import *
+
 
 
 import unittest
@@ -145,7 +145,7 @@ class TestShear(unittest.TestCase):
                 plt.plot(u, z, 'r.')
             z = np.arange(10, 100)
             plt.plot(log_shear(u_star, z0, z), z)
-            show()
+            plt.show()
 
         for _zu, b in zip(zu, log_shear(u_star, z0, [85, 21])):
             self.assertAlmostEqual(_zu[1], b, 4)
@@ -156,10 +156,10 @@ class TestShear(unittest.TestCase):
             for ustar in [1, 2]:
                 for z0 in [1, 10]:
                     z = np.arange(z0, 200)
-                    plot(log_shear(ustar, z0, z), z, label="z0=%d, u*=%d" % (z0, ustar))
-            yscale('log')
-            legend()
-            show()
+                    plt.plot(log_shear(ustar, z0, z), z, label="z0=%d, u*=%d" % (z0, ustar))
+            plt.yscale('log')
+            plt.legend()
+            plt.show()
 
     def test_show_log_shear_stability(self):
         if 0:
@@ -167,10 +167,10 @@ class TestShear(unittest.TestCase):
             ustar = 1
             z = np.arange(z0, 200)
             for L in [-2000, -100, 100, 2000]:
-                plot(log_shear(ustar, z0, z, L), z, label="L=%d" % (L))
+                plt.plot(log_shear(ustar, z0, z, L), z, label="L=%d" % (L))
             #yscale('log')
-            legend()
-            show()
+            plt.legend()
+            plt.show()
 
 
 
-- 
GitLab