Skip to content

Commit

Permalink
Better default values (#287)
Browse files Browse the repository at this point in the history
Set more default values.
Co-authored-by: Tristan Youngs <[email protected]>
  • Loading branch information
jswift-stfc authored Jan 26, 2022
1 parent dbd0060 commit 618a1f6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 34 deletions.
16 changes: 8 additions & 8 deletions src/gudrun_classes/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ def __init__(self):
self.stepSizeMS = 0.0
self.noSlices = 0
self.angularStepForCorrections = 0
self.incidentBeamLeftEdge = 0.0
self.incidentBeamRightEdge = 0.0
self.incidentBeamTopEdge = 0.0
self.incidentBeamBottomEdge = 0.0
self.scatteredBeamLeftEdge = 0.0
self.scatteredBeamRightEdge = 0.0
self.scatteredBeamTopEdge = 0.0
self.scatteredBeamBottomEdge = 0.0
self.incidentBeamLeftEdge = -1.5
self.incidentBeamRightEdge = 1.5
self.incidentBeamTopEdge = 1.5
self.incidentBeamBottomEdge = -1.5
self.scatteredBeamLeftEdge = -2.0
self.scatteredBeamRightEdge = 2.0
self.scatteredBeamTopEdge = 2.0
self.scatteredBeamBottomEdge = -2.0
self.filenameIncidentBeamSpectrumParams = ""
self.overallBackgroundFactor = 0.0
self.sampleDependantBackgroundFactor = 0.0
Expand Down
10 changes: 5 additions & 5 deletions src/gudrun_classes/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ def __init__(self):
self.dataFiles = DataFiles([], "CONTAINER")
self.composition = Composition("CONTAINER")
self.geometry = Geometry.SameAsBeam
self.upstreamThickness = 0.0
self.downstreamThickness = 0.0
self.upstreamThickness = 0.1
self.downstreamThickness = 0.1
self.angleOfRotation = 0.0
self.sampleWidth = 0.0
self.sampleWidth = 5.0
self.innerRadius = 0.0
self.outerRadius = 0.0
self.sampleHeight = 0.0
self.density = 0.0
self.density = 0.0542
self.densityUnits = UnitsOfDensity.ATOMIC
self.totalCrossSectionSource = CrossSectionSource.TABLES
self.crossSectionFilename = ""
self.tweakFactor = 0.0
self.tweakFactor = 1.0
self.scatteringFraction = 0.0
self.attenuationCoefficient = 0.0

Expand Down
3 changes: 2 additions & 1 deletion src/gudrun_classes/gudrun_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,6 @@ def parseNormalisation(self):
)

except Exception as e:
print(e)
raise ParserException(
"Whilst parsing Normalisation, an exception occured."
" The input file is most likely of an incorrect format, "
Expand Down Expand Up @@ -958,6 +957,8 @@ def parseSample(self):
# If the marker line is encountered,
# then the values has been parsed.
line = self.getNextToken()
if "to specify end of exponential parameter input" not in line:
sample.exponentialValues = []
while "to specify end of exponential parameter input" not in line:
sample.exponentialValues.append(
tuple(extract_nums_from_string(line))
Expand Down
2 changes: 0 additions & 2 deletions src/gudrun_classes/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,4 @@ def __str__(self):
f'{numifyBool(self.hardGroupEdges)}{TAB}'
f'Hard group edges?'
f'{nexusDefinitionLine}'
f'0{TAB}Number of iterations'
f'0{TAB}Tweak the tweak factor(s)?'
)
33 changes: 19 additions & 14 deletions src/gudrun_classes/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,35 @@ def __init__(self):
self.name = ""
self.periodNumber = 1
self.dataFiles = DataFiles([], "SAMPLE")
self.forceCalculationOfCorrections = False
self.forceCalculationOfCorrections = True
self.composition = Composition("SAMPLE")
self.geometry = Geometry.SameAsBeam
self.upstreamThickness = 0.0
self.downstreamThickness = 0.0
self.upstreamThickness = 0.05
self.downstreamThickness = 0.05
self.angleOfRotation = 0.0
self.sampleWidth = 0.0
self.sampleWidth = 5.0
self.innerRadius = 0.0
self.outerRadius = 0.0
self.sampleHeight = 0.0
self.density = 0.0
self.density = 0.1
self.densityUnits = UnitsOfDensity.ATOMIC
self.tempForNormalisationPC = 0.0
self.totalCrossSectionSource = CrossSectionSource.TRANSMISSION
self.crossSectionFilename = ""
self.sampleTweakFactor = 0.0
self.topHatW = 0.0
self.FTMode = FTModes.SUB_AVERAGE
self.minRadFT = 0.0
self.sampleTweakFactor = 1.0
self.topHatW = 3.0
self.FTMode = FTModes.ABSOLUTE
self.minRadFT = 0.75
self.grBroadening = 0.0
self.resonanceValues = []
self.exponentialValues = []
self.normalisationCorrectionFactor = 0.0
self.exponentialValues = [(0, 1)]
self.normalisationCorrectionFactor = 1.0
self.fileSelfScattering = ""
self.normaliseTo = NormalisationType.NOTHING
self.maxRadFT = 0.0
self.maxRadFT = 20.0
self.outputUnits = OutputUnits.BARNS_ATOM_SR
self.powerForBroadening = 0.0
self.stepSize = 0.0
self.stepSize = 0.03
self.runThisSample = True
self.scatteringFraction = 0.0
self.attenuationCoefficient = 0.0
Expand Down Expand Up @@ -239,8 +239,13 @@ def __str__(self):
)
)

selfScatteringFile = (
self.fileSelfScattering
if self.fileSelfScattering else "*"
)

selfScatteringLine = (
f'{self.fileSelfScattering}{TAB}'
f'{selfScatteringFile}{TAB}'
f'Name of file containing self scattering'
f' as a function of wavelength [\u212b]\n'
)
Expand Down
8 changes: 4 additions & 4 deletions src/gui/widgets/ui_files/mainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="instrumentPage">
<layout class="QVBoxLayout" name="verticalLayout_9">
Expand Down Expand Up @@ -3930,7 +3930,7 @@
</sizepolicy>
</property>
<property name="suffix">
<string> cm</string>
<string> °</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -6221,7 +6221,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Scattering Fraction</string>
<string>Background Scattering Fraction</string>
</property>
</widget>
</item>
Expand All @@ -6248,7 +6248,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Attenuation Coefficient</string>
<string>Background Attenuation Coefficient</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 618a1f6

Please sign in to comment.