diff --git a/LaueTools/Daxm/modules/__init__.py b/LaueTools/Daxm/modules/__init__.py old mode 100644 new mode 100755 diff --git a/LaueTools/Daxm/scripts/__init__.py b/LaueTools/Daxm/scripts/__init__.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/Build_Summary.py b/LaueTools/FileSeries/Build_Summary.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/Index_Refine.py b/LaueTools/FileSeries/Index_Refine.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/Peak_Search.py b/LaueTools/FileSeries/Peak_Search.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/Plot_Maps2.py b/LaueTools/FileSeries/Plot_Maps2.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/__init__.py b/LaueTools/FileSeries/__init__.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/mainFileSeriesGUI.py b/LaueTools/FileSeries/mainFileSeriesGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/module_graphique.py b/LaueTools/FileSeries/module_graphique.py old mode 100644 new mode 100755 diff --git a/LaueTools/FileSeries/param_multigrain.py b/LaueTools/FileSeries/param_multigrain.py old mode 100644 new mode 100755 diff --git a/LaueTools/FitOrient.py b/LaueTools/FitOrient.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/AutoindexationGUI.py b/LaueTools/GUI/AutoindexationGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/B0matrixLatticeEditor.py b/LaueTools/GUI/B0matrixLatticeEditor.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/CCDFileParametersGUI.py b/LaueTools/GUI/CCDFileParametersGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/DetectorCalibration.py b/LaueTools/GUI/DetectorCalibration.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/DetectorParameters.py b/LaueTools/GUI/DetectorParameters.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/HistogramPlot.py b/LaueTools/GUI/HistogramPlot.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/ImshowFrame.py b/LaueTools/GUI/ImshowFrame.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/LaueSimulatorGUI.py b/LaueTools/GUI/LaueSimulatorGUI.py old mode 100644 new mode 100755 index d88c8e3..c8d426b --- a/LaueTools/GUI/LaueSimulatorGUI.py +++ b/LaueTools/GUI/LaueSimulatorGUI.py @@ -1555,6 +1555,7 @@ def OnSimulate(self, evt): # simulation in class parametric_Grain_Dialog3 self.calib = [self.Det_distance, self.Xcen, self.Ycen, self.Xbet, self.Xgam] + data_res = MGS.dosimulation_parametric(list_param, emax=self.emax, emin=self.emin, diff --git a/LaueTools/GUI/LaueSpotsEditor.py b/LaueTools/GUI/LaueSpotsEditor.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/ManualIndexFrame.py b/LaueTools/GUI/ManualIndexFrame.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/MatrixEditor.py b/LaueTools/GUI/MatrixEditor.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/OpenSpotsListFileGUI.py b/LaueTools/GUI/OpenSpotsListFileGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/PeakSearchGUI.py b/LaueTools/GUI/PeakSearchGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/PeaksListBoard.py b/LaueTools/GUI/PeaksListBoard.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/Plot1DFrame.py b/LaueTools/GUI/Plot1DFrame.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/PlotLimitsBoard.py b/LaueTools/GUI/PlotLimitsBoard.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/PlotRefineGUI.py b/LaueTools/GUI/PlotRefineGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/ProportionalSplitter.py b/LaueTools/GUI/ProportionalSplitter.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/ResultsIndexationGUI.py b/LaueTools/GUI/ResultsIndexationGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/SimulFrame.py b/LaueTools/GUI/SimulFrame.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/__init__.py b/LaueTools/GUI/__init__.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/mainGUI.py b/LaueTools/GUI/mainGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/mosaic.py b/LaueTools/GUI/mosaic.py old mode 100644 new mode 100755 index c9166e9..650f7cb --- a/LaueTools/GUI/mosaic.py +++ b/LaueTools/GUI/mosaic.py @@ -72,337 +72,6 @@ def sttip(argself, strtip): import imageprocessing as ImProc -# class ImshowFrameNew(wx.Frame): -# r""" -# Class to show 2D array intensity data - -# only loarded (but not used) in FileSeries/multigrainFS.py -# """ -# def __init__(self, parent, _id, title, dataarray, posarray_twomotors=None, -# datatype="scalar", -# absolutecornerindices=None, -# Imageindices=None, -# nb_row=10, -# nb_lines=10, -# boxsize_row=10, -# boxsize_line=10, -# stepindex=1, -# imagename="", -# mosaic=0, -# extent=None, -# xylabels=None): -# r""" -# plot 2D plot of dataarray - -# posarray_twomotors = additional info to show in status bar when hovering on plot - -# """ -# # dat=dat.reshape(((self.nb_row)*2*self.boxsize_row,(self.nb_lines)*2*self.boxsize_line)) -# wx.Frame.__init__(self, parent, _id, title, size=(700, 700)) - -# self.data = np.flipud(dataarray) -# try: -# self.dataarray_info = np.flipud(posarray_twomotors) -# except ValueError: -# print("data_info", posarray_twomotors) -# self.dataarray_info = None -# # print "dataarray", dataarray -# self.datatype = datatype - -# self.absolutecornerindices = absolutecornerindices -# self.title = title -# self.Imageindices = np.flipud(Imageindices) -# self.nb_columns = nb_row -# self.nb_lines = nb_lines -# self.boxsize_row = boxsize_row -# self.boxsize_line = boxsize_line -# self.stepindex = stepindex -# self.extent = extent -# self.xylabels = xylabels -# self.imagename = imagename -# self.mosaic = mosaic -# self.dirname = None -# self.filename = None - -# print("self.data.shape in ImshowFrame", self.data.shape) -# print("self.nb_columns, self.nb_lines", self.nb_columns, self.nb_lines) -# print("self.boxsize_row, self.boxsize_line", self.boxsize_row, self.boxsize_line) - -# self.LastLUT = "OrRd" - -# self.create_main_panel() - -# self.clear_axes_create_imshow() - -# def create_main_panel(self): -# r""" create main GUI panel of ImshowFrameNew class -# """ -# # # Set up the MenuBar -# MenuBar = wx.MenuBar() - -# FileMenu = wx.Menu() - -# OpenMenu = FileMenu.Append(wx.ID_ANY, "&Save", "Save Image") -# self.Bind(wx.EVT_MENU, self.OnSave, OpenMenu) - -# # SaveMenu = FileMenu.Append(wx.ID_ANY, "&Save","Save BNA") -# # self.Bind(wx.EVT_MENU, self.SaveBNA, SaveMenu) - -# CloseMenu = FileMenu.Append(wx.ID_ANY, "&Close", "Close Application") -# self.Bind(wx.EVT_MENU, self.OnQuit, CloseMenu) - -# MenuBar.Append(FileMenu, "&File") - -# # view_menu = wx.Menu() -# # ZoomMenu = view_menu.Append(wx.ID_ANY, "Zoom to &Fit","Zoom to fit the window") -# # self.Bind(wx.EVT_MENU, self.ZoomToFit, ZoomMenu) -# # MenuBar.Append(view_menu, "&View") - -# help_menu = wx.Menu() -# AboutMenu = help_menu.Append(wx.ID_ANY, "&About", "More information About this program") -# self.Bind(wx.EVT_MENU, self.OnAbout, AboutMenu) -# MenuBar.Append(help_menu, "&Help") - -# self.SetMenuBar(MenuBar) - -# # # -# self.CreateStatusBar() - -# self.panel = wx.Panel(self) - -# self.dpi = 100 -# self.figsize = 5 -# self.fig = Figure((self.figsize, self.figsize), dpi=self.dpi) -# self.canvas = FigCanvas(self.panel, -1, self.fig) - -# self.axes = self.fig.add_subplot(111) - -# self.toolbar = NavigationToolbar(self.canvas) - -# self.calc_norm_minmax_values() - -# self.slidertxt_min = wx.StaticText(self.panel, -1, "Min :") -# self.slider_min = wx.Slider(self.panel, -1, size=(200, 50), value=0, -# minValue=0, maxValue=99, style=wx.SL_AUTOTICKS | wx.SL_LABELS, ) -# if WXPYTHON4: -# self.slider_min.SetTickFreq(50) -# else: -# self.slider_min.SetTickFreq(50, 1) -# self.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.OnSliderMin, self.slider_min) - -# self.slidertxt_max = wx.StaticText(self.panel, -1, "Max :") -# self.slider_max = wx.Slider(self.panel, -1, size=(200, 50), value=100, -# minValue=1, maxValue=100, style=wx.SL_AUTOTICKS | wx.SL_LABELS, ) -# if WXPYTHON4: -# self.slider_max.SetTickFreq(50) -# else: -# self.slider_max.SetTickFreq(50, 1) -# self.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.OnSliderMax, self.slider_max) - -# # loading LUTS -# self.mapsLUT = [m for m in pcm.datad if not m.endswith("_r")] -# self.mapsLUT.sort() - -# luttxt = wx.StaticText(self.panel, -1, "LUT") -# self.comboLUT = wx.ComboBox(self.panel, -1, self.LastLUT, choices=self.mapsLUT) # , -# # style=wx.CB_READONLY) - -# self.comboLUT.Bind(wx.EVT_COMBOBOX, self.OnChangeLUT) - -# self.scaletype = "Linear" -# # scaletxt = wx.StaticText(self, -1, "Scale") -# self.comboscale = wx.ComboBox(self, -1, self.scaletype, -# choices=["Linear", "Log"], size=(-1, 40)) - -# self.comboscale.Bind(wx.EVT_COMBOBOX, self.OnChangeScale) - -# # --- ---layout -# self.slidersbox = wx.BoxSizer(wx.HORIZONTAL) -# self.slidersbox.Add(self.slidertxt_min, 0) -# self.slidersbox.Add(self.slider_min, 0) -# self.slidersbox.Add(self.slidertxt_max, 0) -# self.slidersbox.Add(self.slider_max, 0) -# self.slidersbox.Add(luttxt, 0) -# self.slidersbox.Add(self.comboLUT, 0) - -# self.vbox = wx.BoxSizer(wx.VERTICAL) -# self.vbox.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) -# self.vbox.Add(self.slidersbox, 0, wx.EXPAND) -# self.vbox.Add(self.toolbar, 0, wx.EXPAND) - -# self.panel.SetSizer(self.vbox) -# self.vbox.Fit(self) -# self.Layout() - -# def OnAbout(self, _): -# pass - -# def OnChangeLUT(self, _): -# print("OnChangeLUT") -# self.myplot.set_cmap(self.comboLUT.GetValue()) - -# self.canvas.draw() - -# def OnSliderMin(self, _): - -# self.IminDisplayed = int(self.slider_min.GetValue()) -# if self.IminDisplayed > self.ImaxDisplayed: -# self.slider_min.SetValue(self.ImaxDisplayed - 1) - -# self.normalizeplot() -# self.canvas.draw() - -# def OnSliderMax(self, _): -# self.ImaxDisplayed = int(self.slider_max.GetValue()) -# if self.ImaxDisplayed < self.IminDisplayed: -# self.slider_max.SetValue(self.IminDisplayed + 1) -# self.normalizeplot() -# self.canvas.draw() - -# def normalizeplot(self): -# deltavals = (self.maxvals - self.minvals) / 100.0 -# vmin = self.minvals + self.IminDisplayed * deltavals -# vmax = self.maxvals + self.ImaxDisplayed * deltavals - -# self.cNorm = mpl.colors.Normalize(vmin=vmin, vmax=vmax) -# self.myplot.set_norm(self.cNorm) - -# def OnSave(self, _): -# # if self.askUserForFilename(defaultFile='truc', style=wx.SAVE,**self.defaultFileDialogOptions()): -# # self.OnSave(event) -# if self.askUserForFilename(): -# fig = self.plotPanel.get_figure() -# fig.savefig(os.path.join(str(self.dirname), str(self.filename))) -# print("Image saved in ", os.path.join(self.dirname, self.filename) + ".png") - -# def askUserForFilename(self, **dialogOptions): -# dialog = wx.FileDialog(self, **dialogOptions) -# if dialog.ShowModal() == wx.ID_OK: -# userProvidedFilename = True -# self.filename = dialog.GetFilename() -# self.dirname = dialog.GetDirectory() -# print(self.filename) -# print(self.dirname) -# else: -# userProvidedFilename = False -# dialog.Destroy() -# return userProvidedFilename - -# def defaultFileDialogOptions(self): -# """ Return a dictionary with file dialog options that can be -# used in both the save file dialog as well as in the open -# file dialog. """ - -# return dict(message="Choose a file", defaultDir=self.dirname, wildcard="*.*") - -# def OnQuit(self, _): -# self.Close(True) - -# def calc_norm_minmax_values(self): -# if self.dataarray_info is not None: -# self.maxvals = np.amax(self.dataarray_info) -# self.minvals = np.amin(self.dataarray_info) - -# print("self.dataarray_info", self.dataarray_info) -# print("self.dataarray_info max ", self.maxvals) -# print("self.dataarray_info min ", self.minvals) - -# self.data_to_Display = self.data -# self.cNorm = None - -# if self.datatype == "scalar": -# print("plot of datatype = %s" % self.datatype) -# try: -# self.data_to_Display = self.data[:, :, 0] -# except IndexError: -# self.data_to_Display = self.data - -# self.maxvals = np.amax(self.data_to_Display) -# self.minvals = np.amin(self.data_to_Display) -# # from matplotlib.colors import colorConverter -# import matplotlib.colors as colors - -# # import matplotlib.pyplot as plt -# # import matplotlib.cm as cmx -# # OrRd = cm = plt.get_cmap('OrRd') -# self.cNorm = colors.Normalize(vmin=self.minvals, vmax=self.maxvals) - -# # scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=OrRd) -# # print scalarMap.get_clim() -# # colorVal = scalarMap.to_rgba(values[idx]) - -# def clear_axes_create_imshow(self): -# """ init the figure -# """ -# def fromindex_to_pixelpos_x_mosaic(index, _): -# return index # self.center[0]-self.boxsize[0]+index - -# def fromindex_to_pixelpos_y_mosaic(index, _): -# return index # self.center[1]-self.boxsize[1]+index - -# # clear the axes and replot everything -# self.axes.cla() -# self.axes.set_title(self.title) -# self.myplot = self.axes.imshow(self.data_to_Display, -# cmap=GT.ORRD, -# interpolation="nearest", -# norm=self.cNorm, -# # extent=self.extent, -# origin="lower") - -# self.axes.xaxis.set_major_formatter(FuncFormatter(fromindex_to_pixelpos_x_mosaic)) -# self.axes.yaxis.set_major_formatter(FuncFormatter(fromindex_to_pixelpos_y_mosaic)) - -# self.axes.set_xlabel(self.xylabels[0]) -# self.axes.set_ylabel(self.xylabels[1]) - -# self.axes.locator_params("x", tight=True, nbins=5) -# self.axes.locator_params("y", tight=True, nbins=5) - -# self.IminDisplayed = 0 -# self.ImaxDisplayed = 200 - -# self.axes.grid(True) - -# # numrows, numcols, color = self.data.shape -# numrows, numcols = self.data.shape[:2] - -# # print "self.Imageindices", self.Imageindices -# # print "self.Imageindices.shape", self.Imageindices.shape -# # print "self.data.shape", self.data.shape - -# # imageindices = self.Imageindices[0] + arange(0, numrows, numcols) * self.stepindex - -# tabindices = self.Imageindices -# # print "tabindices", tabindices - -# def format_coord(x, y): -# col = int(x + 0.5) -# row = int(y + 0.5) -# if col >= 0 and col < numcols and row >= 0 and row < numrows: -# z = self.data[row, col] - -# print("z", z) -# print("x,y,row,col", x, y, row, col) -# Imageindex = tabindices[row, col] -# if self.dataarray_info is None: -# sentence = "x=%1.4f, y=%1.4f, color=%s, ImageIndex: %d" % (x, y, -# str(z), Imageindex) -# else: -# sentence = "x=%1.4f, y=%1.4f, val=%s, ImageIndex: %d" % (x, y, -# self.dataarray_info[row, col], Imageindex) -# self.SetStatusText(sentence) -# return sentence -# else: -# sentence = "x=%1.4f, y=%1.4f" % (x, y) -# self.SetStatusText(sentence) -# return sentence - -# self.axes.format_coord = format_coord - -# self.canvas.draw() - - class ImshowFrame_Scalar(wx.Frame): """ Class to show 2D array intensity data @@ -417,7 +86,7 @@ def __init__(self, parent, _id, title, dataarray, posarray_twomotors=None, Imageindices=None, absolute_motorposition_unit="micron", colorbar_label="Fluo counts", - nb_row=10, + nb_col=10, nb_lines=10, boxsize_row=10, boxsize_line=10, @@ -452,7 +121,7 @@ def __init__(self, parent, _id, title, dataarray, posarray_twomotors=None, self.Imageindices = Imageindices self.colorbar_label = colorbar_label - self.nb_columns = nb_row + self.nb_columns = nb_col self.nb_lines = nb_lines self.boxsize_row = boxsize_row self.boxsize_line = boxsize_line @@ -1059,7 +728,7 @@ class ImshowFrame(wx.Frame): """ def __init__(self, parent, _id, title, dataarray, absolutecornerindices=None, Imageindices=np.arange(2), - nb_row=10, + nb_col=10, nb_lines=10, boxsize_row=10, # TODO row actually is column boxsize_line=10, # TODO line is row @@ -1073,7 +742,7 @@ def __init__(self, parent, _id, title, dataarray, absolutecornerindices=None, """ print("\n\n*****\nCREATING PLOT of 2D Map of Scalar data: %s\n****\n"%title) - # dat=dat.reshape(((self.nb_row)*2*self.boxsize_row,(self.nb_lines)*2*self.boxsize_line)) + # dat=dat.reshape(((self.nb_col)*2*self.boxsize_row,(self.nb_lines)*2*self.boxsize_line)) self.appFrame = wx.Frame.__init__(self, parent, _id, title, size=(900, 700)) try: @@ -1117,11 +786,11 @@ def __init__(self, parent, _id, title, dataarray, absolutecornerindices=None, self.absolutecornerindices = absolutecornerindices self.title = title self.Imageindices = Imageindices - self.nb_columns = nb_row + self.nb_columns = nb_col self.nb_lines = nb_lines self.boxsize_row = boxsize_row self.boxsize_line = boxsize_line - print('nb_row nb_lines', nb_row, nb_lines) + print('nb_col nb_lines', nb_col, nb_lines) print('boxsize_row boxsize_line',boxsize_row, boxsize_line) self.stepindex = stepindex self.imagename = imagename @@ -1331,6 +1000,12 @@ def __init__(self, parent, _id, title, dataarray, absolutecornerindices=None, self.layout() self.setArrayImageIndices() + + + print('self.datatype', self.datatype) + print(self.data.shape) + print(self.Imageindices) + print(self.tabindices) self._replot() def layout(self): @@ -1533,7 +1208,7 @@ def OpenData(self, _): Imageindices = d[:,0].reshape(dshape) imagename = 'test0006.mccd' - nb_row, nb_lines = dshape + nb_col, nb_lines = dshape self.dataraw = copy.copy(dataarray) # data to be displayed @@ -1543,11 +1218,11 @@ def OpenData(self, _): #self.absolutecornerindices = absolutecornerindices self.title = title self.Imageindices = Imageindices - self.nb_columns = nb_row + self.nb_columns = nb_col self.nb_lines = nb_lines #self.boxsize_row = boxsize_row #self.boxsize_line = boxsize_line - #print('nb_row nb_lines', nb_row, nb_lines) + #print('nb_col nb_lines', nb_col, nb_lines) #print('boxsize_row boxsize_line',boxsize_row, boxsize_line) #self.stepindex = stepindex self.imagename = imagename @@ -2263,6 +1938,10 @@ def erase_cursor(self): # --- end of cursor def setArrayImageIndices(self): + """set self.tabindices (2D array) + + .. note: starting index is assumed to be zero ... and step =1 + """ imageindices = np.arange(0, self.nb_lines * self.nb_columns) * self.stepindex self.tabindices = imageindices.reshape((self.nb_lines, self.nb_columns)) @@ -2827,8 +2506,8 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= if plot: plapla = ImshowFrame(parent, -1, "image Plot %s" % counter, dat, - Imageindices=tabindices, - nb_row=nb_col, + Imageindices=tabindices, # 1D list + nb_col=nb_col, nb_lines=nb_lines, stepindex=1, boxsize_row=1, @@ -2839,7 +2518,10 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= plapla.Show() - #np.savetxt("%s_2D" % counter + "_%s" % myformattime(), dat) + # saving this format is worst than the next one ?! + outfilename = os.path.join(outputfolder, "%s" % (counter + "_2D")) + with open(outfilename + "_%s" % myformattime(), 'w') as f: + np.savetxt(f, dat) parent.list_of_windows.append(plapla) @@ -2891,8 +2573,8 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= if plot: ploplo = ImshowFrame(parent, -1, "MOSAIC image Plot", dat, absolutecornerindices=(jmin, imin), - Imageindices=tabindices, - nb_row=nb_col, + Imageindices=tabindices, # 1D list + nb_col=nb_col, nb_lines=nb_lines, boxsize_row=boxsize_col, stepindex=1, @@ -2907,16 +2589,19 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= outfilename = os.path.join(outputfolder, "%s" % ("MOSAIC_image_Plot")) fullpathout=outfilename + "_%s" % myformattime() - headerstr='# datatype: MOSAIC\n# dims: %d %d\n# tabindices: %s\n'%(dat_dims[0],dat_dims[1], str(tabindices)) + headerstr='# datatype: MOSAIC\n# dims: %d %d\n'%(dat_dims[0],dat_dims[1]) + headerstr+='# Imageindices:' + for elem in tabindices: # 1D list + headerstr+=' %d'%elem + headerstr+='\n' headerstr+='# nb_col: %d\n# nb_lines: %d\n'%(nb_col,nb_lines) headerstr+='# boxsize_col: %d\n# boxsize_line: %d\n'%(boxsize_col,boxsize_line) - headerstr+='# title: %s\n'%title + headerstr+='# title: %s'%title f=open(fullpathout,'w') - f.write(headerstr) - np.savetxt(fullpathout, dat) + np.savetxt(fullpathout, dat, header=headerstr,comments='') parent.list_of_windows.append(ploplo) @@ -3035,8 +2720,8 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= print("nb_col,nb_lines", nb_col, nb_lines) plot2DX = ImshowFrame(parent, -1, "image 2D Plot X %s" % counter, dataX_2D, - Imageindices=tabindices, - nb_row=nb_col, + Imageindices=tabindices, # 1D list ? + nb_col=nb_col, nb_lines=nb_lines, stepindex=1, boxsize_row=0, @@ -3056,8 +2741,8 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= if plot and counter == "Position XY": plot2DY = ImshowFrame(parent, -1, "image 2D Plot Y %s" % counter, dataY_2D, - Imageindices=tabindices, - nb_row=nb_col, + Imageindices=tabindices, # 1D list ? + nb_col=nb_col, nb_lines=nb_lines, stepindex=1, boxsize_row=0, @@ -3087,7 +2772,7 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= plot2Dradial = ImshowFrame(parent, -1, "image 2D Plot radial %s" % counter, radialdistance_2D, Imageindices=tabindices, - nb_row=nb_col, + nb_col=nb_col, nb_lines=nb_lines, stepindex=1, boxsize_row=0, @@ -3112,7 +2797,7 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= plot2Dpeaksize = ImshowFrame(parent, -1, "image 2D Plot peak size %s" % counter, maxpeaksize2D, Imageindices=tabindices, - nb_row=nb_col, + nb_col=nb_col, nb_lines=nb_lines, stepindex=1, boxsize_row=0, @@ -3138,7 +2823,7 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= plot2Dpeaksize = ImshowFrame(parent, -1, "image 2D Plot peak amplitude %s" % counter, PeakAmplitude2D, Imageindices=tabindices, - nb_row=nb_col, + nb_col=nb_col, nb_lines=nb_lines, stepindex=1, boxsize_row=0, @@ -3186,7 +2871,7 @@ def buildMosaic3(dict_param, outputfolder, ccdlabel="MARCCD165", plot=1, parent= plotvec = ImshowFrame(parent, -1, "image 2D vector %s" % counter, NormVector, Imageindices=tabindices, - nb_row=nb_col, + nb_col=nb_col, nb_lines=nb_lines, stepindex=1, boxsize_row=0, diff --git a/LaueTools/GUI/plotmeshspecGUI.py b/LaueTools/GUI/plotmeshspecGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/spotslinkeditor.py b/LaueTools/GUI/spotslinkeditor.py old mode 100644 new mode 100755 diff --git a/LaueTools/GUI/threadGUI2.py b/LaueTools/GUI/threadGUI2.py old mode 100644 new mode 100755 diff --git a/LaueTools/IOLaueTools.py b/LaueTools/IOLaueTools.py old mode 100644 new mode 100755 index e582566..3ed167b --- a/LaueTools/IOLaueTools.py +++ b/LaueTools/IOLaueTools.py @@ -451,6 +451,8 @@ def readCalibParametersInFile(openfile, Dict_to_update=None, guessCCDLabel=True) ccdlabel = 'IMSTAR_bin2' elif abs(ps-0.0252) <= 0.001: ccdlabel = 'IMSTAR_bin1' + elif abs(ps-0.2) <= 0.001: + ccdlabel = 'Alban' CCDcalib['CCDLabel'] = ccdlabel @@ -825,7 +827,7 @@ def writefitfile(outputfilename, datatooutput, nb_of_indexedSpots, if "UBB0" in dict_matrices: footer += "UBB0 matrix in q= (UB B0) G* i.e. recip. basis vectors are columns " - footer += "in LT frame: astar = UBB0[0,:], bstar = UBB0[1,:], cstar = UBB0[2,:]. (abcstar as columns on xyzlab1, " + footer += "in LT frame: astar = UBB0[:,0], bstar = UBB0[:,1], cstar = UBB0[:,2]. (abcstar as columns on xyzlab1, " footer += "xlab1 = ui, ui = unit vector along incident beam)\n" footer += str(dict_matrices["UBB0"].round(decimals=8)) + "\n" diff --git a/LaueTools/IOimagefile.py b/LaueTools/IOimagefile.py old mode 100644 new mode 100755 index 1b43739..54e1be6 --- a/LaueTools/IOimagefile.py +++ b/LaueTools/IOimagefile.py @@ -781,7 +781,7 @@ def readCCDimage(filename, CCDLabel="MARCCD165", dirname=None, stackimageindex=- if FABIO_EXISTS: if CCDLabel in ('MARCCD165', "EDF", "EIGER_4M", "EIGER_1M","IMSTAR_bin2","IMSTAR_bin1", "sCMOS", "sCMOS_fliplr", "sCMOS_fliplr_16M", "sCMOS_16M", - "Rayonix MX170-HS", 'psl_weiwei', 'ImageStar_dia_2021','ImageStar_dia_2021_2x2'): + "Rayonix MX170-HS", 'psl_weiwei', 'ImageStar_dia_2021','ImageStar_dia_2021_2x2', 'Alban'): if verbose > 1: print('----> Using fabio ... to open %s\n'%filename) diff --git a/LaueTools/LaueAutoAnalysis.py b/LaueTools/LaueAutoAnalysis.py old mode 100644 new mode 100755 diff --git a/LaueTools/LaueGeometry.py b/LaueTools/LaueGeometry.py old mode 100644 new mode 100755 diff --git a/LaueTools/LaueImages/AH12_CMT_r14_0200.tif b/LaueTools/LaueImages/AH12_CMT_r14_0200.tif old mode 100644 new mode 100755 diff --git a/LaueTools/LaueImages/CdTe_I999_03Jul06_0200.mccd b/LaueTools/LaueImages/CdTe_I999_03Jul06_0200.mccd old mode 100644 new mode 100755 diff --git a/LaueTools/LaueImages/Ge_blanc_0000.dat b/LaueTools/LaueImages/Ge_blanc_0000.dat old mode 100644 new mode 100755 diff --git a/LaueTools/LaueImages/Ge_blanc_0000.mccd b/LaueTools/LaueImages/Ge_blanc_0000.mccd old mode 100644 new mode 100755 diff --git a/LaueTools/LaueImages/SS_0171.mccd b/LaueTools/LaueImages/SS_0171.mccd old mode 100644 new mode 100755 diff --git a/LaueTools/LaueImages/calibGe111.det b/LaueTools/LaueImages/calibGe111.det old mode 100644 new mode 100755 diff --git a/LaueTools/LaueToolsGUI.py b/LaueTools/LaueToolsGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/Lauehdf5.py b/LaueTools/Lauehdf5.py old mode 100644 new mode 100755 diff --git a/LaueTools/MessageCommand.py b/LaueTools/MessageCommand.py old mode 100644 new mode 100755 diff --git a/LaueTools/dict_LaueTools.py b/LaueTools/dict_LaueTools.py old mode 100644 new mode 100755 index 2c21476..6ece513 --- a/LaueTools/dict_LaueTools.py +++ b/LaueTools/dict_LaueTools.py @@ -35,10 +35,11 @@ "FeAl": ["FeAl", [5.871, 5.871, 5.871, 90, 90, 90], "fcc"], "Fe2Ta": ["Fe2Ta", [4.83, 4.83, 0.788, 90, 90, 120], "no"], "Si": ["Si", [5.4309, 5.4309, 5.4309, 90, 90, 90], "dia"], - "3H-SiC": ["3H-SiC", [4.3596, 4.3596, 4.3596, 90, 90, 90], "dia"], # zinc blende - "4H-SiC": ["4H-SiC", [3.073, 3.073, 10.053, 90, 90, 120], "wurtzite"], # wurtzite = 6H-SiC also + "3H-SiC": ["3H-SiC", [4.3596, 4.3596, 4.3596, 90, 90, 90], "dia"], # zinc blende SG 216 + "4H-SiC": ["4H-SiC", [3.073, 3.073, 10.053, 90, 90, 120], "wurtzite"], # wurtzite = 6H-SiC also SG 186 "CdHgTe": ["CdHgTe", [6.46678, 6.46678, 6.46678, 90, 90, 90], "dia"], "CdHgTe_fcc": ["CdHgTe_fcc", [6.46678, 6.46678, 6.46678, 90, 90, 90], "fcc"], + "Cr": ["Cr", [2.87, 2.87, 2.87, 90, 90, 90], "fcc"], # 229 "Ge": ["Ge", [5.6575, 5.6575, 5.6575, 90, 90, 90], "dia"], "Getest": ["Getest", [5.6575, 5.6575, 5.6574, 90, 90, 90], "dia", ], # c is slightly lower "Au": ["Au", [4.078, 4.078, 4.078, 90, 90, 90], "fcc"], @@ -55,6 +56,7 @@ "CCDL1949": ["CCDL1949", [9.89, 17.85, 5.31, 90, 180 - 72.5, 90], "h+k=2n"], "Crocidolite_small": ["Crocidolite_small", [9.76 / 3, 17.93 / 3, 5.35 / 3, 90, 103.6, 90], "no", ], # a= 9.811, b=18.013, c= 5.326A, beta=103,68° "Hematite": ["Hematite", [5.03459, 5.03459, 13.7533, 90, 90, 120], "no", ], # extinction for h+k+l=3n and always les l=2n + "Mg":["Mg",[3.2095,3.2095,5.2104,90,90,120],"no"], "Magnetite_fcc": ["Magnetite_fcc", [8.391, 8.391, 8.391, 90, 90, 90], "fcc", ], # GS 225 fcc extinction "Magnetite": ["Magnetite", [8.391, 8.391, 8.391, 90, 90, 90], "dia"], # GS 227 "Magnetite_sc": ["Magnetite_sc", [8.391, 8.391, 8.391, 90, 90, 90], "no", ], # no extinction @@ -126,6 +128,8 @@ "ZnCuOCl": ["ZnCuOCl", [6.839, 6.839, 14.08, 90.0, 90, 120.0], "SG166"], "ZnCuOCl_all": ["ZnCuOCl_all", [6.839, 6.839, 14.08, 90.0, 90, 120.0], "no"], "FePS3": ["FePS3", [5, 10, 7, 90, 107, 90], "no"], + "Zr": ["Zr", [3.24, 3.24, 5.17, 90, 90, 120], "no"], # 194 + "Nb14W3O44": ["Nb14W3O44", [21.03,21.03,3.93,90, 90, 90], "h+k+l=2n"], #SG 82 } dict_Materials_short = { @@ -357,6 +361,7 @@ def readsinglelinedictfile(line): "VHR_Feb13_rawtiff": ((2594, 2774), 0.031, 10000, "VHR_Feb13", 110, "uint16", " ", "tiff"), "VHR_PSI": ((2615, 3891), 0.0312, 65000, "no", 4096, "uint16", "vhr at psi actually read by libtiff (variable header size and compressed data)", "tif"), "VHR_DLS": ((3056, 3056), 0.0312, 65000, "no", 4096, "uint16", "vhr at dls actually read by libtiff (variable header size and compressed data)", "tif"), + "Alban": [(1504, 1499), 0.2, 65535, "no", -1, "uint16", "Alban de vaucorbeil detector australia", "tif"], "PRINCETON": ((2048, 2048), 0.079, 57000, "no", 4096, "uint16", "ROPER Princeton Quadro 2048x2048 pixels converted from .spe to .mccd", "mccd"), # 2X2, saturation value depends on gain and DAC "FRELON": ((2048, 2048), 0.048, 65000, "frelon2", 1024, "uint16", "FRELON camera 2048x2048 pixels, 2theta axis is horizontal (edf format)", "edf"), "TIFF Format": (-1, -1, "", "", "", "" "CCD parameters read from tiff header", "tiff", ), diff --git a/LaueTools/dragpoints.py b/LaueTools/dragpoints.py old mode 100644 new mode 100755 diff --git a/LaueTools/elasticity.py b/LaueTools/elasticity.py old mode 100644 new mode 100755 diff --git a/LaueTools/findorient.py b/LaueTools/findorient.py old mode 100644 new mode 100755 diff --git a/LaueTools/fit2Dintensity.py b/LaueTools/fit2Dintensity.py old mode 100644 new mode 100755 diff --git a/LaueTools/fit2Dintensity_Lorentz.py b/LaueTools/fit2Dintensity_Lorentz.py old mode 100644 new mode 100755 diff --git a/LaueTools/generaltools.py b/LaueTools/generaltools.py old mode 100644 new mode 100755 diff --git a/LaueTools/graingraph.py b/LaueTools/graingraph.py old mode 100644 new mode 100755 diff --git a/LaueTools/icons/down2.png b/LaueTools/icons/down2.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/exit.png b/LaueTools/icons/exit.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/left2.png b/LaueTools/icons/left2.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/right2.png b/LaueTools/icons/right2.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/save.png b/LaueTools/icons/save.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/transmissionLaue.png b/LaueTools/icons/transmissionLaue.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/transmissionLaue_fcc_111.png b/LaueTools/icons/transmissionLaue_fcc_111.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/transmissionLauesmall.png b/LaueTools/icons/transmissionLauesmall.png old mode 100644 new mode 100755 diff --git a/LaueTools/icons/up2.png b/LaueTools/icons/up2.png old mode 100644 new mode 100755 diff --git a/LaueTools/imageprocessing.py b/LaueTools/imageprocessing.py old mode 100644 new mode 100755 diff --git a/LaueTools/indexingAnglesLUT.py b/LaueTools/indexingAnglesLUT.py old mode 100644 new mode 100755 diff --git a/LaueTools/indexingImageMatching.py b/LaueTools/indexingImageMatching.py old mode 100644 new mode 100755 diff --git a/LaueTools/indexingSpotsSet.py b/LaueTools/indexingSpotsSet.py old mode 100644 new mode 100755 diff --git a/LaueTools/indexrefine.py b/LaueTools/indexrefine.py old mode 100644 new mode 100755 diff --git a/LaueTools/lauecore.py b/LaueTools/lauecore.py old mode 100644 new mode 100755 index fab6407..787b35c --- a/LaueTools/lauecore.py +++ b/LaueTools/lauecore.py @@ -660,6 +660,7 @@ def create_spot(pos_vec, miller, detectordistance, allattributes=False, pixelsiz dim=(2048, 2048)): r""" From reciprocal space position and 3 miller indices create a spot instance (on top camera geometry) + warning: by default only 1 attribute: Qxyz vector :param pos_vec: 3D vector :type pos_vec: list of 3 float @@ -713,6 +714,8 @@ def create_spot_np(Qxyz, miller, detectordistance, allattributes=False, :return: spot instance .. note:: spot.Qxyz is a vector expressed in lauetools frame + .. note:: spot pixel cam positions are not calculated here. + X along x-ray and Z towards CCD when CCD on top and y towards experimental hutch door """ @@ -759,7 +762,7 @@ def create_spot_4pi(pos_vec, miller, detectordistance, allattributes=0, pixelsiz def create_spot_side_pos(pos_vec, miller, detectordistance, - allattributes=0, + allattributes=False, pixelsize=165.0 / 2048, dim=(2048, 2048)): r""" From reciprocal space position and 3 miller indices @@ -775,7 +778,7 @@ def create_spot_side_pos(pos_vec, miller, detectordistance, + spotty.Qxyz[1] ** 2 + spotty.Qxyz[2] ** 2) - if not allattributes: + if allattributes: X = (detectordistance * (spotty.Qxyz[0] + spotty.EwaldRadius) / spotty.Qxyz[1]) Y = detectordistance * (spotty.Qxyz[2]) / spotty.Qxyz[1] # spotty.Xcam = X / pixelsize + dim[0] / 2 @@ -808,7 +811,7 @@ def create_spot_side_neg(pos_vec, miller, detectordistance, allattributes=0, pix + spotty.Qxyz[1] ** 2 + spotty.Qxyz[2] ** 2) - if not allattributes: + if allattributes: X = (-detectordistance * (spotty.Qxyz[0] + spotty.EwaldRadius) / spotty.Qxyz[1]) Y = detectordistance * (spotty.Qxyz[2]) / spotty.Qxyz[1] spotty.Xcam = X / pixelsize + dim[0] / 2.0 @@ -826,6 +829,8 @@ def create_spot_front(pos_vec, miller, detectordistance, allattributes=0, dim=(2048, 2048)): r""" From reciprocal space position and 3 miller indices create a spot on forward direction transmission geometry + + .. note: at this step: crude Xcam Ycam spot attributes with ideal detector pointing towards sample """ # print "use create_spot_front" spotty = spot(miller) @@ -861,10 +866,13 @@ def create_spot_front(pos_vec, miller, detectordistance, allattributes=0, return None -def create_spot_back(pos_vec, miller, detectordistance, allattributes=0, +def create_spot_back(pos_vec, miller, detectordistance, allattributes=False, pixelsize=165.0 / 2048, dim=(2048, 2048)): r""" From reciprocal space position and 3 miller indices create a spot on backward directions i.e. back reflection geometry + + .. note: at this step: crude Xcam Ycam spot attributes with ideal detector pointing towards sample + """ spotty = spot(miller) spotty.Qxyz = pos_vec @@ -874,7 +882,7 @@ def create_spot_back(pos_vec, miller, detectordistance, allattributes=0, abskx = math.fabs(spotty.Qxyz[0] + spotty.EwaldRadius) normkout = math.sqrt(abskx ** 2 + spotty.Qxyz[1] ** 2 + spotty.Qxyz[2] ** 2) - if not allattributes: + if allattributes: X = detectordistance * (spotty.Qxyz[1]) / abskx Y = detectordistance * (spotty.Qxyz[2]) / abskx spotty.Xcam = X / pixelsize + dim[0] / 2.0 @@ -1389,7 +1397,9 @@ def get2ThetaChi_geometry(oncam_vec, oncam_HKL, detectordistance=DEFAULT_DETECTO kf_direction=DEFAULT_TOP_GEOMETRY): r""" computes list of spots instances from oncam_vec (q 3D vectors) - and oncam_HKL (miller indices 3D vectors) + and oncam_HKL (miller indices 3D vectors), with crude Xcam Ycam pixel positions for ideal plan detector + + Warning: pixel X,Y peaks positions (Xcam and YCam) are roughly computed for perfect detector plane pointing towards sample. For kf_direction Z>0, pixel position is evaluated precisely later with a LaueGeomtry module's function calc_xycam_from_2thetachi() :param oncam_vec: q vectors [qx,qy,qz] (corresponding to kf collected on camera) :type oncam_vec: array with 3D elements (shape = (n,3)) @@ -1420,8 +1430,13 @@ def get2ThetaChi_geometry(oncam_vec, oncam_HKL, detectordistance=DEFAULT_DETECTO if len(oncam_vec) != len(oncam_HKL): raise ValueError("Wrong input for get2ThetaChi_geometry()") + COMPUTE_ALL_SPOTATTRIBUTES = False + + if kf_direction in ('Y>0', 'Y>0'): + COMPUTE_ALL_SPOTATTRIBUTES = True + listspot = [] - options_createspot = {"allattributes": 0, "pixelsize": pixelsize, "dim": dim} + options_createspot = {"allattributes": COMPUTE_ALL_SPOTATTRIBUTES, "pixelsize": pixelsize, "dim": dim} dictcase = {"Z>0": create_spot, # top reflection geom "Y>0": create_spot_side_pos, # side + reflection geom @@ -1816,6 +1831,15 @@ def SimulateLaue(grain, emin, emax, detectorparameters, kf_direction=DEFAULT_TOP pixelsize=pixelsize, kf_direction=kf_direction, version=version)[:2] + print('posx, posy with calc_xycam_from2thetachi() ',posx[:5],posy[:5]) + + if kf_direction in ('Y>0', 'Y<0'): + + posx = [spot.Xcam for spot in ListofSpots] + posy = [spot.Ycam for spot in ListofSpots] + + print('posx, posy with Xcam and Ycam atttibutes',posx[:5],posy[:5]) + return Twicetheta, Chi, Miller_ind, posx, posy, Energy diff --git a/LaueTools/lauetools.py b/LaueTools/lauetools.py old mode 100644 new mode 100755 diff --git a/LaueTools/logfile_reader.py b/LaueTools/logfile_reader.py old mode 100644 new mode 100755 diff --git a/LaueTools/mapanalyzer.py b/LaueTools/mapanalyzer.py old mode 100644 new mode 100755 diff --git a/LaueTools/matchingrate.py b/LaueTools/matchingrate.py old mode 100644 new mode 100755 diff --git a/LaueTools/multigrainsSimulator.py b/LaueTools/multigrainsSimulator.py old mode 100644 new mode 100755 index 62dcfa1..a615266 --- a/LaueTools/multigrainsSimulator.py +++ b/LaueTools/multigrainsSimulator.py @@ -103,6 +103,15 @@ def dosimulation_parametric(_list_param, Transform_params=None, SelectGrains=Non """ print("\n\n********* Starting dosimulation_parametric *********\n\n") + # print('_list_param',_list_param) + # print('SelectGrains',SelectGrains) + # print('detectordistance',detectordistance) + # print('detectordiameter',detectordiameter) + # print('posCEN',posCEN) + # print('cameraAngles',cameraAngles) + # print('kf_direction',kf_direction) + # print('pixelsize',pixelsize) + # Number_ParentGrains parent grains Number_ParentGrains = len(_list_param) @@ -496,20 +505,15 @@ def dosimulation_parametric(_list_param, Transform_params=None, SelectGrains=Non calib = [detectordistance, posCEN[0], posCEN[1], cameraAngles[0], cameraAngles[1]] - posx, posy = LTGeo.calc_xycam_from2thetachi(twicetheta, chi, calib, - pixelsize=pixelsize, - kf_direction=kf_direction)[:2] - # posx, posy, theta0 = LTGeo.calc_xycam_from2thetachi(twicetheta, chi, calib, pixelsize = self.pixelsize) + # posx, posy = LTGeo.calc_xycam_from2thetachi(twicetheta, chi, calib, + # pixelsize=pixelsize, + # kf_direction=kf_direction)[:2] + print('Y>0 2theta ', twicetheta[:5]) posx = [spot.Xcam for spot in Laue_spot_list[0]] posy = [spot.Ycam for spot in Laue_spot_list[0]] - # vecRR = [ - # spot.Qxyz for spot in Laue_spot_list[0] - # ] # uf_lab in JSM frame - - # print "twicetheta",twicetheta - # print "2*th0",(2*theta0).tolist() + print('Y>0 posx ', posx[:5]) list_twicetheta.append(twicetheta) list_chi.append(chi) diff --git a/LaueTools/orientations.py b/LaueTools/orientations.py old mode 100644 new mode 100755 diff --git a/LaueTools/param_multigrain.py b/LaueTools/param_multigrain.py old mode 100644 new mode 100755 diff --git a/LaueTools/peaksearch.py b/LaueTools/peaksearch.py old mode 100644 new mode 100755 diff --git a/LaueTools/plotmap.py b/LaueTools/plotmap.py old mode 100644 new mode 100755 diff --git a/LaueTools/plotmeshspecGUI.py b/LaueTools/plotmeshspecGUI.py old mode 100644 new mode 100755 diff --git a/LaueTools/readmccd.py b/LaueTools/readmccd.py old mode 100644 new mode 100755 diff --git a/LaueTools/rectangle.py b/LaueTools/rectangle.py old mode 100644 new mode 100755 diff --git a/LaueTools/scripts/__init__.py b/LaueTools/scripts/__init__.py old mode 100644 new mode 100755 diff --git a/LaueTools/scripts/scripts_findorient.py b/LaueTools/scripts/scripts_findorient.py old mode 100644 new mode 100755 diff --git a/LaueTools/scripts/scripts_fitorient.py b/LaueTools/scripts/scripts_fitorient.py old mode 100644 new mode 100755 diff --git a/LaueTools/tifffile.py b/LaueTools/tifffile.py old mode 100644 new mode 100755