Skip to content

Commit

Permalink
Merge pull request #2647 from SasView/2369-multiplicity-copy
Browse files Browse the repository at this point in the history
Various Multiplicity Model Fixes
Merging as agreed. Much improved multiplicity behavior and not time to put our pencils down. I have moved the comment by @pkienzle in #1089 which is being closed by this merge to #2243 for safe keeping. Created a new ticket, #2866 about SQ causing a reset of multiplicity parameters and #2867 about the error reported above about the SLD profile button causing an error when it is part of a mixture model with one SLD multiplicity model.
  • Loading branch information
butlerpd authored May 3, 2024
2 parents 731ea4b + a5972fe commit 58e7f62
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 176 deletions.
91 changes: 46 additions & 45 deletions src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,19 +882,23 @@ def formatParametersExcel(parameters: list):
check = ""
for parameter in parameters:
names += parameter[0]+tab
# Add the error column if fitted
if parameter[1] == "True" and parameter[3] is not None:
names += parameter[0]+"_err"+tab

values += parameter[2]+tab
check += parameter[1]+tab
if parameter[1] == "True" and parameter[3] is not None:
values += parameter[3]+tab
# add .npts and .nsigmas when necessary
if parameter[0][-6:] == ".width":
names += parameter[0].replace('.width', '.nsigmas') + tab
names += parameter[0].replace('.width', '.npts') + tab
values += parameter[5] + tab + parameter[4] + tab
if len(parameter) > 3:
# Add the error column if fitted
if parameter[1] == "True" and parameter[3] is not None:
names += parameter[0]+"_err"+tab

values += parameter[2]+tab
check += str(parameter[1])+tab
if parameter[1] == "True" and parameter[3] is not None:
values += parameter[3]+tab
# add .npts and .nsigmas when necessary
if parameter[0][-6:] == ".width":
names += parameter[0].replace('.width', '.nsigmas') + tab
names += parameter[0].replace('.width', '.npts') + tab
values += parameter[5] + tab + parameter[4] + tab
else:
# Empty statement for debugging purposes
pass

output_string = names + crlf + values + crlf + check
return output_string
Expand All @@ -913,46 +917,43 @@ def formatParametersLatex(parameters: list):
output_string += r'}\hline'
output_string += crlf

names = ""
values = ""

for index, parameter in enumerate(parameters):
name = parameter[0] # Parameter name
output_string += name.replace('_', r'\_') # Escape underscores
# Add the error column if fitted
if parameter[1] == "True" and parameter[3] is not None:
output_string += ' & '
output_string += parameter[0]+r'\_err'

if index < len(parameters) - 1:
output_string += ' & '

# add .npts and .nsigmas when necessary
if parameter[0][-6:] == ".width":
output_string += parameter[0].replace('.width', '.nsigmas') + ' & '
output_string += parameter[0].replace('.width', '.npts')
names += name.replace('_', r'\_') # Escape underscores
if len(parameter) > 3:
values += f" {parameter[2]}"
# Add the error column if fitted
if parameter[1] == "True" and parameter[3] is not None:
names += f" & {parameter[0]} " + r'\_err'
values += f' & {parameter[3]}'

if index < len(parameters) - 1:
output_string += ' & '
names += ' & '
values += ' & '

# add .npts and .nsigmas when necessary
if parameter[0][-6:] == ".width":
names += parameter[0].replace('.width', '.nsigmas') + ' & '
names += parameter[0].replace('.width', '.npts')
values += parameter[5] + ' & '
values += parameter[4]

if index < len(parameters) - 1:
names += ' & '
values += ' & '
elif len(parameter) > 2:
values += f' & {parameter[2]} &'
else:
values += f' & {parameter[1]} &'

output_string += names
output_string += r'\\ \hline'
output_string += crlf

# Construct row of values and errors
for index, parameter in enumerate(parameters):
output_string += parameter[2]
if parameter[1] == "True" and parameter[3] is not None:
output_string += ' & '
output_string += parameter[3]

if index < len(parameters) - 1:
output_string += ' & '

# add .npts and .nsigmas when necessary
if parameter[0][-6:] == ".width":
output_string += parameter[5] + ' & '
output_string += parameter[4]

if index < len(parameters) - 1:
output_string += ' & '

output_string += values
output_string += r'\\ \hline'
output_string += crlf
output_string += r'\end{tabular}'
Expand Down
Loading

0 comments on commit 58e7f62

Please sign in to comment.