Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 90 additions & 5 deletions mcstas-comps/samples/Single_crystal.comp
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,97 @@ struct hkl_data
{
struct hkl_data const *pa = a;
struct hkl_data const *pb = b;
double s = pa->tau - pb->tau;

if (!s) return 0;
else return (s < 0 ? -1 : 1);
} /* PN_list_compare */

/* Sort by tau */
if (pa->tau < pb->tau) return -1;
if (pa->tau > pb->tau) return 1;

/* Sort by tau_x */
if (pa->tau_x < pb->tau_x) return -1;
if (pa->tau_x > pb->tau_x) return 1;

/* Sort by tau_y */
if (pa->tau_y < pb->tau_y) return -1;
if (pa->tau_y > pb->tau_y) return 1;

/* Sort by tau_z */
if (pa->tau_z < pb->tau_z) return -1;
if (pa->tau_z > pb->tau_z) return 1;

/* In case of tie, sort by h also */
if (pa->h < pb->h) return -1;
if (pa->h > pb->h) return 1;

/* In case of tie, sort by k also */
if (pa->k < pb->k) return -1;
if (pa->k > pb->k) return 1;

/* In case of tie, sort by l also */
if (pa->l < pb->l) return -1;
if (pa->l > pb->l) return 1;

/* In case of tie, sort by F2 also */
if (pa->F2 < pb->F2) return -1;
if (pa->F2 > pb->F2) return 1;

/* In case of tie, sort by cutoff also */
if (pa->cutoff < pb->cutoff) return -1;
if (pa->cutoff > pb->cutoff) return 1;

/* In case of tie, sort by sig123 also */
if (pa->sig123 < pb->sig123) return -1;
if (pa->sig123 > pb->sig123) return 1;

/* In case of tie, sort by m1 also */
if (pa->m1 < pb->m1) return -1;
if (pa->m1 > pb->m1) return 1;

/* In case of tie, sort by sig123 also */
if (pa->m2 < pb->m2) return -1;
if (pa->m2 > pb->m2) return 1;

/* In case of tie, sort by m3 also */
if (pa->m3 < pb->m3) return -1;
if (pa->m3 > pb->m3) return 1;

/* In case of tie, sort by u1x also */
if (pa->u1x < pb->u1x) return -1;
if (pa->u1x > pb->u1x) return 1;

/* In case of tie, sort by u1y also */
if (pa->u1y < pb->u1y) return -1;
if (pa->u1y > pb->u1y) return 1;

/* In case of tie, sort by u1z also */
if (pa->u1z < pb->u1z) return -1;
if (pa->u1z > pb->u1z) return 1;

/* In case of tie, sort by u2x also */
if (pa->u2x < pb->u2x) return -1;
if (pa->u2x > pb->u2x) return 1;

/* In case of tie, sort by u2y also */
if (pa->u2y < pb->u2y) return -1;
if (pa->u2y > pb->u2y) return 1;

/* In case of tie, sort by u2z also */
if (pa->u2z < pb->u2z) return -1;
if (pa->u2z > pb->u2z) return 1;

/* In case of tie, sort by u3x also */
if (pa->u3x < pb->u3x) return -1;
if (pa->u3x > pb->u3x) return 1;

/* In case of tie, sort by u3y also */
if (pa->u3y < pb->u3y) return -1;
if (pa->u3y > pb->u3y) return 1;

/* In case of tie, sort by u3z also */
if (pa->u3z < pb->u3z) return -1;
if (pa->u3z > pb->u3z) return 1;

return 0;
} /* SX_list_compare */

#ifndef CIF2HKL
#define CIF2HKL
Expand Down
96 changes: 91 additions & 5 deletions mcstas-comps/union/Single_crystal_process.comp
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,97 @@ SHARE
{
struct hkl_data_union const *pa = a;
struct hkl_data_union const *pb = b;
double s = pa->tau - pb->tau;

if (!s) return 0;
else return (s < 0 ? -1 : 1);
} /* PN_list_compare */

/* Sort by tau */
if (pa->tau < pb->tau) return -1;
if (pa->tau > pb->tau) return 1;

/* Sort by tau_x */
if (pa->tau_x < pb->tau_x) return -1;
if (pa->tau_x > pb->tau_x) return 1;

/* Sort by tau_y */
if (pa->tau_y < pb->tau_y) return -1;
if (pa->tau_y > pb->tau_y) return 1;

/* Sort by tau_z */
if (pa->tau_z < pb->tau_z) return -1;
if (pa->tau_z > pb->tau_z) return 1;

/* In case of tie, sort by h also */
if (pa->h < pb->h) return -1;
if (pa->h > pb->h) return 1;

/* In case of tie, sort by k also */
if (pa->k < pb->k) return -1;
if (pa->k > pb->k) return 1;

/* In case of tie, sort by l also */
if (pa->l < pb->l) return -1;
if (pa->l > pb->l) return 1;

/* In case of tie, sort by F2 also */
if (pa->F2 < pb->F2) return -1;
if (pa->F2 > pb->F2) return 1;

/* In case of tie, sort by cutoff also */
if (pa->cutoff < pb->cutoff) return -1;
if (pa->cutoff > pb->cutoff) return 1;

/* In case of tie, sort by sig123 also */
if (pa->sig123 < pb->sig123) return -1;
if (pa->sig123 > pb->sig123) return 1;

/* In case of tie, sort by m1 also */
if (pa->m1 < pb->m1) return -1;
if (pa->m1 > pb->m1) return 1;

/* In case of tie, sort by sig123 also */
if (pa->m2 < pb->m2) return -1;
if (pa->m2 > pb->m2) return 1;

/* In case of tie, sort by m3 also */
if (pa->m3 < pb->m3) return -1;
if (pa->m3 > pb->m3) return 1;

/* In case of tie, sort by u1x also */
if (pa->u1x < pb->u1x) return -1;
if (pa->u1x > pb->u1x) return 1;

/* In case of tie, sort by u1y also */
if (pa->u1y < pb->u1y) return -1;
if (pa->u1y > pb->u1y) return 1;

/* In case of tie, sort by u1z also */
if (pa->u1z < pb->u1z) return -1;
if (pa->u1z > pb->u1z) return 1;

/* In case of tie, sort by u2x also */
if (pa->u2x < pb->u2x) return -1;
if (pa->u2x > pb->u2x) return 1;

/* In case of tie, sort by u2y also */
if (pa->u2y < pb->u2y) return -1;
if (pa->u2y > pb->u2y) return 1;

/* In case of tie, sort by u2z also */
if (pa->u2z < pb->u2z) return -1;
if (pa->u2z > pb->u2z) return 1;

/* In case of tie, sort by u3x also */
if (pa->u3x < pb->u3x) return -1;
if (pa->u3x > pb->u3x) return 1;

/* In case of tie, sort by u3y also */
if (pa->u3y < pb->u3y) return -1;
if (pa->u3y > pb->u3y) return 1;

/* In case of tie, sort by u3z also */
if (pa->u3z < pb->u3z) return -1;
if (pa->u3z > pb->u3z) return 1;

return 0;
} /* SX_list_compare */

/* ------------------------------------------------------------------------ */
int
Expand Down
92 changes: 89 additions & 3 deletions mcxtrace-comps/samples/Single_crystal.comp
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,96 @@ SHARE
{
struct hkl_data const *pa = a;
struct hkl_data const *pb = b;
double s = pa->tau - pb->tau;

if (!s) return 0;
else return (s < 0 ? -1 : 1);
/* Sort by tau */
if (pa->tau < pb->tau) return -1;
if (pa->tau > pb->tau) return 1;

/* Sort by tau_x */
if (pa->tau_x < pb->tau_x) return -1;
if (pa->tau_x > pb->tau_x) return 1;

/* Sort by tau_y */
if (pa->tau_y < pb->tau_y) return -1;
if (pa->tau_y > pb->tau_y) return 1;

/* Sort by tau_z */
if (pa->tau_z < pb->tau_z) return -1;
if (pa->tau_z > pb->tau_z) return 1;

/* In case of tie, sort by h also */
if (pa->h < pb->h) return -1;
if (pa->h > pb->h) return 1;

/* In case of tie, sort by k also */
if (pa->k < pb->k) return -1;
if (pa->k > pb->k) return 1;

/* In case of tie, sort by l also */
if (pa->l < pb->l) return -1;
if (pa->l > pb->l) return 1;

/* In case of tie, sort by F2 also */
if (pa->F2 < pb->F2) return -1;
if (pa->F2 > pb->F2) return 1;

/* In case of tie, sort by cutoff also */
if (pa->cutoff < pb->cutoff) return -1;
if (pa->cutoff > pb->cutoff) return 1;

/* In case of tie, sort by sig123 also */
if (pa->sig123 < pb->sig123) return -1;
if (pa->sig123 > pb->sig123) return 1;

/* In case of tie, sort by m1 also */
if (pa->m1 < pb->m1) return -1;
if (pa->m1 > pb->m1) return 1;

/* In case of tie, sort by sig123 also */
if (pa->m2 < pb->m2) return -1;
if (pa->m2 > pb->m2) return 1;

/* In case of tie, sort by m3 also */
if (pa->m3 < pb->m3) return -1;
if (pa->m3 > pb->m3) return 1;

/* In case of tie, sort by u1x also */
if (pa->u1x < pb->u1x) return -1;
if (pa->u1x > pb->u1x) return 1;

/* In case of tie, sort by u1y also */
if (pa->u1y < pb->u1y) return -1;
if (pa->u1y > pb->u1y) return 1;

/* In case of tie, sort by u1z also */
if (pa->u1z < pb->u1z) return -1;
if (pa->u1z > pb->u1z) return 1;

/* In case of tie, sort by u2x also */
if (pa->u2x < pb->u2x) return -1;
if (pa->u2x > pb->u2x) return 1;

/* In case of tie, sort by u2y also */
if (pa->u2y < pb->u2y) return -1;
if (pa->u2y > pb->u2y) return 1;

/* In case of tie, sort by u2z also */
if (pa->u2z < pb->u2z) return -1;
if (pa->u2z > pb->u2z) return 1;

/* In case of tie, sort by u3x also */
if (pa->u3x < pb->u3x) return -1;
if (pa->u3x > pb->u3x) return 1;

/* In case of tie, sort by u3y also */
if (pa->u3y < pb->u3y) return -1;
if (pa->u3y > pb->u3y) return 1;

/* In case of tie, sort by u3z also */
if (pa->u3z < pb->u3z) return -1;
if (pa->u3z > pb->u3z) return 1;

return 0;
} /* SX_list_compare */

#ifndef CIF2HKL
Expand Down
3 changes: 3 additions & 0 deletions tools/Python/mccodelib/mccode_config.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"BROWSER": "@BROWSER@",
"GUICOLS": "3",
"GUIFONTSIZE": "12",
"GUILOGCOLOR": "blue",
"GUIINFOCOLOR": "green",
"GUIERRCOLOR": "red",
"NDBUFFERSIZE": "10000000",
"EDITOR": "@EDITOR@",
"FORMAT": "McCode",
Expand Down
19 changes: 13 additions & 6 deletions tools/Python/mcgui/viewclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ def closeCodeEditorWindow(self):
'''
def updateInstrument(self, labels, instr):
''' labels: <instrument path>, <work dir> '''
self.mw.ui.lblInstrument.setText(labels[0])
if len(labels[0])>70:
label=str(pathlib.Path("(..long dirname..)",pathlib.Path(labels[0]).name))
tooltip="Located in: "+str(pathlib.Path(labels[0]).parent)
else:
label=labels[0]
tooltip=labels[0]
self.mw.ui.lblInstrument.setText(label)
self.mw.ui.lblInstrument.setToolTip(tooltip)
if str(labels[0]) == '':
self.__ssd = None
if Qsci:
Expand All @@ -85,11 +92,11 @@ def updateLog(self, text='', error=False, gui=False, clear=False):
if clear:
self.mw.ui.txtbrwMcgui.setText('Cleared messages.')
if error:
self.mw.ui.txtbrwMcgui.setTextColor(QtGui.QColor('red'))
self.mw.ui.txtbrwMcgui.setTextColor(QtGui.QColor(mccode_config.configuration["GUIERRCOLOR"]))
elif gui:
self.mw.ui.txtbrwMcgui.setTextColor(QtGui.QColor('blue'))
self.mw.ui.txtbrwMcgui.setTextColor(QtGui.QColor(mccode_config.configuration["GUILOGCOLOR"]))
else:
self.mw.ui.txtbrwMcgui.setTextColor(QtGui.QColor('green'))
self.mw.ui.txtbrwMcgui.setTextColor(QtGui.QColor(mccode_config.configuration["GUIINFOCOLOR"]))
self.mw.ui.txtbrwMcgui.append(text)

def disableRunBtn(self):
Expand All @@ -116,9 +123,9 @@ def updateSimState(self, state=[]):
ui.btnEdit.setEnabled(enableRun)
ui.btnPlot.setEnabled(enablePlot)
if enableRun:
ui.lblInstrument.setStyleSheet('color: green')
ui.lblInstrument.setStyleSheet('color: ' + mccode_config.configuration["GUILOGCOLOR"])
else:
ui.lblInstrument.setStyleSheet('color: red')
ui.lblInstrument.setStyleSheet('color: ' + mccode_config.configuration["GUIERRCOLOR"])
ui.actionClose_Instrument.setEnabled(enableRun)
ui.actionPlot.setEnabled(enablePlot)
ui.actionDisplay.setEnabled(enableRun)
Expand Down
Loading