sda.plot.fplotanalyzer#
Created on Wed Dec 03 15:26:27 2014.
@author: Erwan Pannier
Plot any format of data immediatly
GUI feature : - drag and drop text files in the box - they are plotted immediatly
Features to implement : - if drag&drop several files then plot all of them on the same graph? - loadany ne marche pas si j’importe un fichier Lecroy avec des espaces au lieu de ‘,’
# Do some test runs on standard plots
Known bugs : - lastx is taken from figure : if x is resized during the plot (ex : s * 1e9 -> ns) then lines won’t be plotted on the same figure. Should we create a SmartFigure class with “apparent x” and “real x” ?
TODO : titles should appear as header if multifile and header is None. Then
keep the folder as title.
TODO : check that FastPlot is working if no X in input
TODO: script version. fplot %file or fplot %folder
Classes#
Methods to guess what kind of data we are looking at, and plot it. |
|
Start interface for drag & dropping files in. |
Functions#
|
|
|
Longest common substring from a list of strings. |
|
Module Contents#
- class sda.plot.fplotanalyzer.Analyser(filename, plot=True, lastfig=None, norm=False, verbose=False, warnings=True)#
Methods to guess what kind of data we are looking at, and plot it.
- verbose = False#
- warnings = True#
- normalize = False#
- plot = True#
- filename#
- lastfig = None#
- known_typex#
- known_typey#
- typex_family#
- header = None#
- analyse()#
Run the data analysis.
Also create self.fig when plotting
- apply_known_format()#
Update self.typex, self.typey.
May change self.header, self.data too in very special cases (first row of data appears as non-explicit legend.
- magnorder(a)#
Return average and maximum order of magnitude of the signal.
- let_guess(guess, guessin)#
If guess were restricted to the list ‘guessin’ because of the file.
format, then make sure the guess is in the list. If not restricted list, then accept.
- guessx(x, guessin=None)#
Guessin : to limit the choices available.
- guessy(y, guessin=None)#
Guessin : to limit the choices available.
- get_figure(x, lastfig)#
Plot the new line on the same figure as previous plots.
Plot if :
xdata was analysed to be the same datatype
or, if x is exactly the same.
TODO : xdatatype is to be guessed from xlabel from the previous fig. It could be interesting to create a new class derived from Figure containing directly the real data, apparent data, and datatype.
- getData(filename)#
- look_for_header_row()#
In some data set the first row / column may be used as an unformal.
(= correct data type) header. In this function we detect this kind of row / column, fix the data and return the header file.
- getLabel(filename)#
- scalex(x, typex)#
- scaley(y, typey)#
- plotData(data, label, header, lastfig=None)#
Plot the data.
TODO : when adding several data, make sure x matches and update ylabel and title correctly.
- class sda.plot.fplotanalyzer.FileListWidget(parent, verbose=True, norm=False)#
Bases:
PyQt5.QtWidgets.QListWidget- verbose = True#
- normalize = False#
- dragEnterEvent(event)#
- dragMoveEvent(event)#
- dropEvent(event)#
- add_files(files)#
Add all items contained in files.
Analyse and plot them.
If 2 files, try to compare them. Else, just plot everyone one the same graph if possible
- analyseData(filename, lastfig)#
Analyser and plot process.
- clean_layout()#
Remove the common part not to have too huge titles.
Add a legend if several graphs.
# Todo: replace by remove common prefix / common suffix
- class sda.plot.fplotanalyzer.Interface(verbose=True, norm=False)#
Bases:
PyQt5.QtWidgets.QWidgetStart interface for drag & dropping files in.
- verbose = True#
- normalize = False#
- heights#
- lbds#
- initUI()#
- listItemRightClicked(QPos)#
- plot_files(files)#
External function to plot files directly from the command line.
- sda.plot.fplotanalyzer.plotany(datafiles)#
- sda.plot.fplotanalyzer.long_substr(data)#
Longest common substring from a list of strings.
Code taken from:
- sda.plot.fplotanalyzer.is_substr(find, data)#