Skip to content

Commit

Permalink
Initial clean up of Python files in scripts
Browse files Browse the repository at this point in the history
Refs #11144
  • Loading branch information
DanNixon committed Feb 23, 2015
1 parent 7596968 commit df8d3d8
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 22 deletions.
Expand Up @@ -16,7 +16,7 @@
# Set initial parameters for peak finding
ExpectedHeight = -1000.0 # Expected Height of Gaussian Peaks (initial value of fit parameter)
ExpectedWidth = 8.0 # Expected width of Gaussian peaks in pixels (initial value of fit parameter)
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0]
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0]
# Expected positions of the edges and Gaussian peaks in pixels (initial values of fit parameters)

# Set what we want to calibrate (e.g whole intrument or one door )
Expand Down
Expand Up @@ -18,7 +18,7 @@
from tube_spec import TubeSpec


def CalibrateWish( run_per_panel_list):
def CalibrateWish(run_per_panel_list):
'''
:param run_per_panel_list: is a list of tuples with the run number and the associated panel
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/scripts/Calibration/tube_calib_fit_params.py
@@ -1,7 +1,7 @@
from mantid.simpleapi import *
from mantid.kernel import *

class TubeCalibFitParams:
class TubeCalibFitParams(object):

# This class is to take the fitting method and parameters for fitting the peaks crated by the calibration slits etc
# and to deliver them to TubeCalib, so it can fit the peaks appropriately
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/scripts/Calibration/tube_spec.py
Expand Up @@ -108,7 +108,7 @@ def isTube(self, comp):
"""
# We simply assume it's a tube if it has a large number of children
if hasattr( comp, "nelements"):
return comp.nelements() >= self.minNumDetsInTube
return comp.nelements() >= self.minNumDetsInTube
else:
return False

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/scripts/CrystalTools/PeakReport.py
Expand Up @@ -9,7 +9,7 @@
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import *

class PeakReport:
class PeakReport(object):
"""
Peak Report is a class used to creating one or more peak integration reports as PDFs.
"""
Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/scripts/Engineering/EnginXUtils.py
Expand Up @@ -43,4 +43,3 @@ def isIndexInBank(index):

return filter(isIndexInBank, range(0, ws.getNumberHistograms()))


14 changes: 8 additions & 6 deletions Code/Mantid/scripts/FilterEvents/eventFilterGUI.py
@@ -1,7 +1,7 @@
#pylint: disable=invalid-name
import numpy

from Ui_MainWindow import Ui_MainWindow #import line for the UI python class
from FilterEvents.Ui_MainWindow import Ui_MainWindow #import line for the UI python class
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
Expand Down Expand Up @@ -33,7 +33,7 @@ class MyPopErrorMsg(QWidget):
def __init__(self):
""" Init
"""
import Ui_ErrorMessage as errui
import FilterEvents.Ui_ErrorMessage as errui
QWidget.__init__(self)


Expand All @@ -58,10 +58,10 @@ def quit(self):

return

def XpaintEvent(self, e):
def XpaintEvent(self, _):
""" ???
"""
import Ui_ErrorMessage as errui
import FilterEvents.Ui_ErrorMessage as errui

self.ui = errui.Ui_Dialog()
self.ui.setupUi(self)
Expand Down Expand Up @@ -107,6 +107,8 @@ class MainWindow(QtGui.QMainWindow):
"""

_errMsgWindow = None

def __init__(self, parent=None):
""" Intialization and set up
"""
Expand Down Expand Up @@ -445,8 +447,8 @@ def set_stopTime(self):

# Correct value
resetT = True
if irightvalue >= 100:
irightvalue == 100
if irightvalue > 100:
irightvalue = 100
elif irightvalue < self._leftSlideValue:
irightvalue = self._leftSlideValue
else:
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py
@@ -1,6 +1,6 @@
#pylint: disable=invalid-name
from PropertiesDescriptors import *
from RunDescriptor import RunDescriptor,RunDescriptorDependent
from Direct.PropertiesDescriptors import *
from Direct.RunDescriptor import RunDescriptor,RunDescriptorDependent


class NonIDF_Properties(object):
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py
Expand Up @@ -556,6 +556,8 @@ def _parce_string2list(self,val):
#-----------------------------------------------------------------------------------------
class PropertyFromRange(PropDescriptor):
""" Descriptor for property, which can have one value from a list of values """
_current_value = None

def __init__(self,availible_values,default_value):
self._availible_values = availible_values
self.__set__(None,default_value)
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/scripts/Inelastic/Direct/PropertyManager.py
@@ -1,5 +1,5 @@
#pylint: disable=invalid-name
from NonIDF_Properties import *
from Direct.NonIDF_Properties import *

from collections import OrderedDict

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py
Expand Up @@ -3,7 +3,7 @@
from mantid import config,api
from mantid.kernel import funcreturns

from PropertyManager import PropertyManager
from Direct.PropertyManager import PropertyManager
# this import is used by children
from Direct.DirectEnergyConversion import DirectEnergyConversion
#import inspect
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py
Expand Up @@ -3,7 +3,7 @@


from mantid.simpleapi import *
from PropertiesDescriptors import *
from Direct.PropertiesDescriptors import *
import re


Expand Down Expand Up @@ -701,4 +701,4 @@ def __set__(self,instance,value):
# DeleteWorkspace(self._ws_name)
# object.__del__(self)



2 changes: 1 addition & 1 deletion Code/Mantid/scripts/Inelastic/Direct/dgreduce.py
@@ -1,6 +1,6 @@
#pylint: disable=invalid-name
""" Empty class temporary left for compatibility with previous interfaces """
import DirectEnergyConversion as DRC
import Direct.DirectEnergyConversion as DRC
from mantid.simpleapi import *
from mantid.kernel import funcreturns

Expand Down
Expand Up @@ -69,5 +69,6 @@ def getStringProperty(workspace, property):
inst = mantid.AnalysisDataService[workspace].getInstrument()
try:
prop = inst.getStringParameter(property)[0]
except IndexError: return ""
except IndexError:
return ""
return prop
6 changes: 4 additions & 2 deletions Code/Mantid/scripts/Inelastic/IndirectEnergyConversion.py
Expand Up @@ -34,8 +34,10 @@ def loadData(rawfiles, outWS='RawFile', Sum=False, SpecMin=-1, SpecMax=-1,\
return workspaces

def createMappingFile(groupFile, ngroup, nspec, first):
if ngroup == 1 : return 'All'
if nspec == 1 : return 'Individual'
if ngroup == 1:
return 'All'
if nspec == 1:
return 'Individual'
filename = config['defaultsave.directory']
filename = os.path.join(filename, groupFile)
handle = open(filename, 'w')
Expand Down
Expand Up @@ -35,6 +35,7 @@ class LoadData(ReductionStep):
_data_files = {}
_extra_load_opts = {}
_contains_event_data = False
_reducer = None

def __init__(self):
"""Initialise the ReductionStep. Constructor should set the initial
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/scripts/Inelastic/msg_reducer.py
Expand Up @@ -26,6 +26,8 @@ class MSGReducer(reducer.Reducer):
_save_formats = []
_info_table_props = None
_extra_load_opts = {}
_reduction_steps = None
_data_files = None

def __init__(self):
super(MSGReducer, self).__init__()
Expand Down

0 comments on commit df8d3d8

Please sign in to comment.