Commit 5aeb156036da0627001744b563b39e932a52f1f2
1 parent
ea934521
Fix a couple of minor code quality issues
Showing
8 changed files
with
23 additions
and
24 deletions
cscripts/cslightcrv.py
| ... | ... | @@ -30,7 +30,7 @@ from cscripts import mputils |
| 30 | 30 | # Global functions for multiprocessing support # |
| 31 | 31 | # ============================================ # |
| 32 | 32 | def _multiprocessing_func_wrapper(args): |
| 33 | - return _multiprocessing_func(*args) | |
| 33 | + return _multiprocessing_func(*args) | |
| 34 | 34 | def _multiprocessing_func(cls, i): |
| 35 | 35 | |
| 36 | 36 | # Initialise thread logger |
| ... | ... | @@ -41,13 +41,13 @@ def _multiprocessing_func(cls, i): |
| 41 | 41 | cstart = cls.celapse() |
| 42 | 42 | result = cls._timebin(i) |
| 43 | 43 | celapse = cls.celapse() - cstart |
| 44 | - buffer = cls._log.buffer() | |
| 44 | + log = cls._log.buffer() | |
| 45 | 45 | |
| 46 | 46 | # Close logger |
| 47 | 47 | cls._log.close() |
| 48 | 48 | |
| 49 | 49 | # Collect thread information |
| 50 | - info = {'celapse': celapse, 'log': buffer} | |
| 50 | + info = {'celapse': celapse, 'log': log} | |
| 51 | 51 | |
| 52 | 52 | # Return light curve bin result and thread information |
| 53 | 53 | return result, info | ... | ... |
cscripts/csphagen.py
| ... | ... | @@ -29,7 +29,7 @@ from cscripts import mputils |
| 29 | 29 | # Global functions for multiprocessing support # |
| 30 | 30 | # ============================================ # |
| 31 | 31 | def _multiprocessing_func_wrapper(args): |
| 32 | - return _multiprocessing_func(*args) | |
| 32 | + return _multiprocessing_func(*args) | |
| 33 | 33 | def _multiprocessing_func(cls, i): |
| 34 | 34 | |
| 35 | 35 | # Initialise thread logger |
| ... | ... | @@ -40,13 +40,13 @@ def _multiprocessing_func(cls, i): |
| 40 | 40 | cstart = cls.celapse() |
| 41 | 41 | result = cls._process_observation(i) |
| 42 | 42 | celapse = cls.celapse() - cstart |
| 43 | - buffer = cls._log.buffer() | |
| 43 | + log = cls._log.buffer() | |
| 44 | 44 | |
| 45 | 45 | # Close logger |
| 46 | 46 | cls._log.close() |
| 47 | 47 | |
| 48 | 48 | # Collect thread information |
| 49 | - info = {'celapse': celapse, 'log': buffer} | |
| 49 | + info = {'celapse': celapse, 'log': log} | |
| 50 | 50 | |
| 51 | 51 | # Return light curve bin result and thread information |
| 52 | 52 | return result, info | ... | ... |
cscripts/csphasecrv.py
| ... | ... | @@ -29,7 +29,7 @@ from cscripts import mputils |
| 29 | 29 | # Global functions for multiprocessing support # |
| 30 | 30 | # ============================================ # |
| 31 | 31 | def _multiprocessing_func_wrapper(args): |
| 32 | - return _multiprocessing_func(*args) | |
| 32 | + return _multiprocessing_func(*args) | |
| 33 | 33 | def _multiprocessing_func(cls, phbin): |
| 34 | 34 | |
| 35 | 35 | # Initialise thread logger |
| ... | ... | @@ -40,13 +40,13 @@ def _multiprocessing_func(cls, phbin): |
| 40 | 40 | cstart = cls.celapse() |
| 41 | 41 | result = cls._phase_bin(phbin) |
| 42 | 42 | celapse = cls.celapse() - cstart |
| 43 | - buffer = cls._log.buffer() | |
| 43 | + log = cls._log.buffer() | |
| 44 | 44 | |
| 45 | 45 | # Close logger |
| 46 | 46 | cls._log.close() |
| 47 | 47 | |
| 48 | 48 | # Collect thread information |
| 49 | - info = {'celapse': celapse, 'log': buffer} | |
| 49 | + info = {'celapse': celapse, 'log': log} | |
| 50 | 50 | |
| 51 | 51 | # Return light curve bin result and thread information |
| 52 | 52 | return result, info | ... | ... |
cscripts/cspull.py
| ... | ... | @@ -30,7 +30,7 @@ from cscripts import mputils |
| 30 | 30 | # Global functions for multiprocessing support # |
| 31 | 31 | # ============================================ # |
| 32 | 32 | def _multiprocessing_func_wrapper(args): |
| 33 | - return _multiprocessing_func(*args) | |
| 33 | + return _multiprocessing_func(*args) | |
| 34 | 34 | def _multiprocessing_func(cls, i): |
| 35 | 35 | |
| 36 | 36 | # Initialise thread logger |
| ... | ... | @@ -41,13 +41,13 @@ def _multiprocessing_func(cls, i): |
| 41 | 41 | cstart = cls.celapse() |
| 42 | 42 | result = cls._trial(i) |
| 43 | 43 | celapse = cls.celapse() - cstart |
| 44 | - buffer = cls._log.buffer() | |
| 44 | + log = cls._log.buffer() | |
| 45 | 45 | |
| 46 | 46 | # Close logger |
| 47 | 47 | cls._log.close() |
| 48 | 48 | |
| 49 | 49 | # Collect thread information |
| 50 | - info = {'celapse': celapse, 'log': buffer} | |
| 50 | + info = {'celapse': celapse, 'log': log} | |
| 51 | 51 | |
| 52 | 52 | # Return light curve bin result and thread information |
| 53 | 53 | return result, info | ... | ... |
cscripts/cssens.py
| ... | ... | @@ -32,7 +32,7 @@ from cscripts import mputils |
| 32 | 32 | # Global functions for multiprocessing support # |
| 33 | 33 | # ============================================ # |
| 34 | 34 | def _multiprocessing_func_wrapper(args): |
| 35 | - return _multiprocessing_func(*args) | |
| 35 | + return _multiprocessing_func(*args) | |
| 36 | 36 | def _multiprocessing_func(cls, i): |
| 37 | 37 | |
| 38 | 38 | # Initialise thread logger |
| ... | ... | @@ -43,13 +43,13 @@ def _multiprocessing_func(cls, i): |
| 43 | 43 | cstart = cls.celapse() |
| 44 | 44 | result = cls._e_bin(i) |
| 45 | 45 | celapse = cls.celapse() - cstart |
| 46 | - buffer = cls._log.buffer() | |
| 46 | + log = cls._log.buffer() | |
| 47 | 47 | |
| 48 | 48 | # Close logger |
| 49 | 49 | cls._log.close() |
| 50 | 50 | |
| 51 | 51 | # Collect thread information |
| 52 | - info = {'celapse': celapse, 'log': buffer} | |
| 52 | + info = {'celapse': celapse, 'log': log} | |
| 53 | 53 | |
| 54 | 54 | # Return light curve bin result and thread information |
| 55 | 55 | return result, info | ... | ... |
cscripts/csspec.py
| ... | ... | @@ -28,7 +28,7 @@ from cscripts import mputils |
| 28 | 28 | # Global functions for multiprocessing support # |
| 29 | 29 | # ============================================ # |
| 30 | 30 | def _multiprocessing_func_wrapper(args): |
| 31 | - return _multiprocessing_func(*args) | |
| 31 | + return _multiprocessing_func(*args) | |
| 32 | 32 | def _multiprocessing_func(cls, i): |
| 33 | 33 | |
| 34 | 34 | # Initialise thread logger |
| ... | ... | @@ -39,13 +39,13 @@ def _multiprocessing_func(cls, i): |
| 39 | 39 | cstart = cls.celapse() |
| 40 | 40 | result = cls._fit_energy_bin(i) |
| 41 | 41 | celapse = cls.celapse() - cstart |
| 42 | - buffer = cls._log.buffer() | |
| 42 | + log = cls._log.buffer() | |
| 43 | 43 | |
| 44 | 44 | # Close logger |
| 45 | 45 | cls._log.close() |
| 46 | 46 | |
| 47 | 47 | # Collect thread information |
| 48 | - info = {'celapse': celapse, 'log': buffer} | |
| 48 | + info = {'celapse': celapse, 'log': log} | |
| 49 | 49 | |
| 50 | 50 | # Return light curve bin result and thread information |
| 51 | 51 | return result, info | ... | ... |
cscripts/cstsdist.py
| ... | ... | @@ -31,7 +31,7 @@ from cscripts import mputils |
| 31 | 31 | # Global functions for multiprocessing support # |
| 32 | 32 | # ============================================ # |
| 33 | 33 | def _multiprocessing_func_wrapper(args): |
| 34 | - return _multiprocessing_func(*args) | |
| 34 | + return _multiprocessing_func(*args) | |
| 35 | 35 | def _multiprocessing_func(cls, i): |
| 36 | 36 | |
| 37 | 37 | # Initialise thread logger |
| ... | ... | @@ -42,13 +42,13 @@ def _multiprocessing_func(cls, i): |
| 42 | 42 | cstart = cls.celapse() |
| 43 | 43 | result = cls._trial(i) |
| 44 | 44 | celapse = cls.celapse() - cstart |
| 45 | - buffer = cls._log.buffer() | |
| 45 | + log = cls._log.buffer() | |
| 46 | 46 | |
| 47 | 47 | # Close logger |
| 48 | 48 | cls._log.close() |
| 49 | 49 | |
| 50 | 50 | # Collect thread information |
| 51 | - info = {'celapse': celapse, 'log': buffer} | |
| 51 | + info = {'celapse': celapse, 'log': log} | |
| 52 | 52 | |
| 53 | 53 | # Return light curve bin result and thread information |
| 54 | 54 | return result, info | ... | ... |
test/test_cscript.py
| 1 | 1 | #! /usr/bin/env python |
| 2 | 2 | # ========================================================================== |
| 3 | -# This scripts performs unit tests for the cspull script. | |
| 3 | +# This scripts performs unit tests for the cscript base classes. | |
| 4 | 4 | # |
| 5 | 5 | # Copyright (C) 2016-2018 Juergen Knoedlseder |
| 6 | 6 | # |
| ... | ... | @@ -341,7 +341,7 @@ class Test(test): |
| 341 | 341 | test = cscript_test() |
| 342 | 342 | |
| 343 | 343 | # Recover User parameters |
| 344 | - pars = test.pars() | |
| 344 | + pars = test.pars() | |
| 345 | 345 | |
| 346 | 346 | # Create a copy of the User parameters |
| 347 | 347 | cpy_pars = pars.copy() |
| ... | ... | @@ -352,7 +352,6 @@ class Test(test): |
| 352 | 352 | # Return |
| 353 | 353 | return (test, pars, cpy_pars) |
| 354 | 354 | |
| 355 | - | |
| 356 | 355 | # Test cscript base class |
| 357 | 356 | def _test_cscript(self): |
| 358 | 357 | """ | ... | ... |