├── OriginTemplates ├── LTHistory.txt ├── Backup.opj ├── Filter.ini ├── LINE.emf ├── LINE.otp ├── NLSF.ini ├── OUbtn.ini ├── Origin.ini ├── Oubtn2.ini ├── excel.otw ├── A1A2B1B2.bmp ├── Backup.opju ├── EQE-Line.emf ├── EQE-Line.otp ├── GenericY.emf ├── GenericY.otp ├── SCATTER.emf ├── SCATTER.otp ├── Template.ini ├── Userdef.bmp ├── V-Lin-Sq.emf ├── V-Lin-Sq.otp ├── Y-Error.emf ├── Y-Error.otp ├── userdef2.bmp ├── EF-Lin-Sq.emf ├── EF-Lin-Sq.otp ├── EL-Lin-Sq.emf ├── EL-Lin-Sq.otp ├── LINE-Square.emf ├── LINE-Square.otp ├── NLSFwiz_OPS.bmp ├── NLSFwizard.ini ├── PL-Lin-Sq.emf ├── PL-Lin-Sq.otp ├── dV-Lin-Sq.emf ├── dV-Lin-Sq.otp ├── Laser-Lin-Sq.emf ├── Laser-Lin-Sq.otp ├── Origin Folder.lnk │ ├── desktop.ini │ └── target.lnk ├── OubtnA1A2B1B2.ini ├── PL_Transient.emf ├── PL_Transient.otp ├── Spectra_Wide.emf ├── Spectra_Wide.otp ├── Spectrum-Line.emf ├── Spectrum-Line.otp ├── TransientLine.emf ├── TransientLine.otp ├── J-V_LogLog_Thin.emf ├── J-V_LogLog_Thin.otp ├── JV-LogLog-Line.emf ├── JV-LogLog-Line.otp ├── Lifetime-V-Line.emf ├── Lifetime-V-Line.otp ├── Origin Samples Folder.lnk │ ├── desktop.ini │ └── target.lnk ├── Spectra_Square.emf ├── Spectra_Square.otp ├── EQE-J_LinLog_Wide.emf ├── EQE-J_LinLog_Wide.otp ├── J-V_LogLog_Square.emf ├── J-V_LogLog_Square.otp ├── JV-Lum-LogLog-Line.emf ├── JV-Lum-LogLog-Line.otp ├── Lifetime-Lum-Line.emf ├── Lifetime-Lum-Line.otp ├── Lum-V_LogLog_Thin.emf ├── Lum-V_LogLog_Thin.otp ├── EQE-J_LinLog_Square.emf ├── EQE-J_LinLog_Square.otp ├── LifetimeYY-Lum-V-Line.emf ├── LifetimeYY-Lum-V-Line.otp ├── Lum-V_LogLog_Square.emf ├── Lum-V_LogLog_Square.otp ├── OIMG.INI ├── MenuCommands_E.txt ├── Themes │ ├── AnalysisAndReportTable │ │ ├── 0-pfit2l-Last used.ois │ │ ├── 0-speedmode-Last used.ois │ │ ├── 0-wtranspose-Last used.ois │ │ ├── 0-differentiate-Last used.ois │ │ ├── 0-rnormalize-Last used.ois │ │ ├── 0-interp1-Last used.ois │ │ ├── 0-interp1xy-Last used.ois │ │ ├── 0-fft_filters-Last used.ois │ │ ├── 0-pef_pptslide-Last used.ois │ │ ├── 0-smooth-Last used.ois │ │ ├── 0-template_saveas-Last used.ois │ │ ├── 0-fft1-Last used.ois │ │ ├── 0-merge_graph-Last used.ois │ │ ├── 0-merge_graph-merge_test_1.ois │ │ ├── 0-batchProcess-Last used.ois │ │ ├── 0-DescStats-Last used.ois │ │ ├── 0-addtool_quickfit-Last used.ois │ │ ├── 0-expGraph-Last used.ois │ │ ├── 0-expGraph-ExportPNGtoDesktop.ois │ │ ├── 0-expGraph-ExportPNG.ois │ │ ├── 0-expGraph-ExportMEML.ois │ │ ├── 0-expGraph-ExportDossier.ois │ │ ├── 0-FitLinear-Last used.ois │ │ ├── 0-Fitexp-Last used.ois │ │ └── 0-Fitpeak-Last used.ois │ └── Graph │ │ ├── Wes_Darjeeling3.oth │ │ ├── Wes_Moonrise1.oth │ │ ├── Wes_Moonrise7.oth │ │ ├── Wes_Zissou5.oth │ │ ├── Wes_Moonrise5.oth │ │ ├── temp.oth │ │ ├── YlOrRd.oth │ │ ├── cb2_BuGn.oth │ │ ├── cb2_Greens.oth │ │ ├── cb2_QualSet1.oth │ │ ├── cb2_RdBu.oth │ │ ├── cb2_Reds.oth │ │ ├── cb2_BluesDown.oth │ │ ├── cb2_BluesUp.oth │ │ ├── Tableau10.oth │ │ ├── cb2_PuOr.oth │ │ ├── colorbrewer2-qualitative.oth │ │ ├── Tableau_Light.oth │ │ ├── Tableau_Medium.oth │ │ ├── cb2_spectral.oth │ │ ├── mpl_inferno11.oth │ │ └── Tableau_ColorBlind.oth ├── Custom.ogs ├── MRFiles.ini ├── SYSTEM.CNF └── template.xml ├── example.png ├── Documentation ├── MATLAB_Documentation │ ├── test.opj │ ├── Y-Error.otp │ ├── SummaryPlots.opj │ ├── PlotXY_example_data.mat │ ├── sendXYToOrigin.m │ ├── CreatePlotInOrigin.m │ ├── example_doubleY_plot.m │ ├── MATLABCallOrigin.m │ ├── OriginPlotExample.m │ ├── tester2.m │ └── OriginPlotXY.m └── origin_test.py ├── LICENSE ├── .gitignore ├── README.md ├── Numpy_to_Originlab_example.ipynb ├── Communicating with origin examples.ipynb └── py2origin.py /OriginTemplates/LTHistory.txt: -------------------------------------------------------------------------------- 1 | 2 | //--2018-03-07 11:57 3 | 4 | -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/example.png -------------------------------------------------------------------------------- /OriginTemplates/Backup.opj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Backup.opj -------------------------------------------------------------------------------- /OriginTemplates/Filter.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Filter.ini -------------------------------------------------------------------------------- /OriginTemplates/LINE.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/LINE.emf -------------------------------------------------------------------------------- /OriginTemplates/LINE.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/LINE.otp -------------------------------------------------------------------------------- /OriginTemplates/NLSF.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/NLSF.ini -------------------------------------------------------------------------------- /OriginTemplates/OUbtn.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/OUbtn.ini -------------------------------------------------------------------------------- /OriginTemplates/Origin.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Origin.ini -------------------------------------------------------------------------------- /OriginTemplates/Oubtn2.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Oubtn2.ini -------------------------------------------------------------------------------- /OriginTemplates/excel.otw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/excel.otw -------------------------------------------------------------------------------- /OriginTemplates/A1A2B1B2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/A1A2B1B2.bmp -------------------------------------------------------------------------------- /OriginTemplates/Backup.opju: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Backup.opju -------------------------------------------------------------------------------- /OriginTemplates/EQE-Line.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EQE-Line.emf -------------------------------------------------------------------------------- /OriginTemplates/EQE-Line.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EQE-Line.otp -------------------------------------------------------------------------------- /OriginTemplates/GenericY.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/GenericY.emf -------------------------------------------------------------------------------- /OriginTemplates/GenericY.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/GenericY.otp -------------------------------------------------------------------------------- /OriginTemplates/SCATTER.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/SCATTER.emf -------------------------------------------------------------------------------- /OriginTemplates/SCATTER.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/SCATTER.otp -------------------------------------------------------------------------------- /OriginTemplates/Template.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Template.ini -------------------------------------------------------------------------------- /OriginTemplates/Userdef.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Userdef.bmp -------------------------------------------------------------------------------- /OriginTemplates/V-Lin-Sq.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/V-Lin-Sq.emf -------------------------------------------------------------------------------- /OriginTemplates/V-Lin-Sq.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/V-Lin-Sq.otp -------------------------------------------------------------------------------- /OriginTemplates/Y-Error.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Y-Error.emf -------------------------------------------------------------------------------- /OriginTemplates/Y-Error.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Y-Error.otp -------------------------------------------------------------------------------- /OriginTemplates/userdef2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/userdef2.bmp -------------------------------------------------------------------------------- /OriginTemplates/EF-Lin-Sq.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EF-Lin-Sq.emf -------------------------------------------------------------------------------- /OriginTemplates/EF-Lin-Sq.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EF-Lin-Sq.otp -------------------------------------------------------------------------------- /OriginTemplates/EL-Lin-Sq.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EL-Lin-Sq.emf -------------------------------------------------------------------------------- /OriginTemplates/EL-Lin-Sq.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EL-Lin-Sq.otp -------------------------------------------------------------------------------- /OriginTemplates/LINE-Square.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/LINE-Square.emf -------------------------------------------------------------------------------- /OriginTemplates/LINE-Square.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/LINE-Square.otp -------------------------------------------------------------------------------- /OriginTemplates/NLSFwiz_OPS.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/NLSFwiz_OPS.bmp -------------------------------------------------------------------------------- /OriginTemplates/NLSFwizard.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/NLSFwizard.ini -------------------------------------------------------------------------------- /OriginTemplates/PL-Lin-Sq.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/PL-Lin-Sq.emf -------------------------------------------------------------------------------- /OriginTemplates/PL-Lin-Sq.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/PL-Lin-Sq.otp -------------------------------------------------------------------------------- /OriginTemplates/dV-Lin-Sq.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/dV-Lin-Sq.emf -------------------------------------------------------------------------------- /OriginTemplates/dV-Lin-Sq.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/dV-Lin-Sq.otp -------------------------------------------------------------------------------- /OriginTemplates/Laser-Lin-Sq.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Laser-Lin-Sq.emf -------------------------------------------------------------------------------- /OriginTemplates/Laser-Lin-Sq.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Laser-Lin-Sq.otp -------------------------------------------------------------------------------- /OriginTemplates/Origin Folder.lnk/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D} 3 | Flags=2 4 | -------------------------------------------------------------------------------- /OriginTemplates/OubtnA1A2B1B2.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/OubtnA1A2B1B2.ini -------------------------------------------------------------------------------- /OriginTemplates/PL_Transient.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/PL_Transient.emf -------------------------------------------------------------------------------- /OriginTemplates/PL_Transient.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/PL_Transient.otp -------------------------------------------------------------------------------- /OriginTemplates/Spectra_Wide.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Spectra_Wide.emf -------------------------------------------------------------------------------- /OriginTemplates/Spectra_Wide.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Spectra_Wide.otp -------------------------------------------------------------------------------- /OriginTemplates/Spectrum-Line.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Spectrum-Line.emf -------------------------------------------------------------------------------- /OriginTemplates/Spectrum-Line.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Spectrum-Line.otp -------------------------------------------------------------------------------- /OriginTemplates/TransientLine.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/TransientLine.emf -------------------------------------------------------------------------------- /OriginTemplates/TransientLine.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/TransientLine.otp -------------------------------------------------------------------------------- /OriginTemplates/J-V_LogLog_Thin.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/J-V_LogLog_Thin.emf -------------------------------------------------------------------------------- /OriginTemplates/J-V_LogLog_Thin.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/J-V_LogLog_Thin.otp -------------------------------------------------------------------------------- /OriginTemplates/JV-LogLog-Line.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/JV-LogLog-Line.emf -------------------------------------------------------------------------------- /OriginTemplates/JV-LogLog-Line.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/JV-LogLog-Line.otp -------------------------------------------------------------------------------- /OriginTemplates/Lifetime-V-Line.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lifetime-V-Line.emf -------------------------------------------------------------------------------- /OriginTemplates/Lifetime-V-Line.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lifetime-V-Line.otp -------------------------------------------------------------------------------- /OriginTemplates/Origin Samples Folder.lnk/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D} 3 | Flags=2 4 | -------------------------------------------------------------------------------- /OriginTemplates/Spectra_Square.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Spectra_Square.emf -------------------------------------------------------------------------------- /OriginTemplates/Spectra_Square.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Spectra_Square.otp -------------------------------------------------------------------------------- /OriginTemplates/EQE-J_LinLog_Wide.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EQE-J_LinLog_Wide.emf -------------------------------------------------------------------------------- /OriginTemplates/EQE-J_LinLog_Wide.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EQE-J_LinLog_Wide.otp -------------------------------------------------------------------------------- /OriginTemplates/J-V_LogLog_Square.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/J-V_LogLog_Square.emf -------------------------------------------------------------------------------- /OriginTemplates/J-V_LogLog_Square.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/J-V_LogLog_Square.otp -------------------------------------------------------------------------------- /OriginTemplates/JV-Lum-LogLog-Line.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/JV-Lum-LogLog-Line.emf -------------------------------------------------------------------------------- /OriginTemplates/JV-Lum-LogLog-Line.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/JV-Lum-LogLog-Line.otp -------------------------------------------------------------------------------- /OriginTemplates/Lifetime-Lum-Line.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lifetime-Lum-Line.emf -------------------------------------------------------------------------------- /OriginTemplates/Lifetime-Lum-Line.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lifetime-Lum-Line.otp -------------------------------------------------------------------------------- /OriginTemplates/Lum-V_LogLog_Thin.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lum-V_LogLog_Thin.emf -------------------------------------------------------------------------------- /OriginTemplates/Lum-V_LogLog_Thin.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lum-V_LogLog_Thin.otp -------------------------------------------------------------------------------- /OriginTemplates/EQE-J_LinLog_Square.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EQE-J_LinLog_Square.emf -------------------------------------------------------------------------------- /OriginTemplates/EQE-J_LinLog_Square.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/EQE-J_LinLog_Square.otp -------------------------------------------------------------------------------- /OriginTemplates/LifetimeYY-Lum-V-Line.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/LifetimeYY-Lum-V-Line.emf -------------------------------------------------------------------------------- /OriginTemplates/LifetimeYY-Lum-V-Line.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/LifetimeYY-Lum-V-Line.otp -------------------------------------------------------------------------------- /OriginTemplates/Lum-V_LogLog_Square.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lum-V_LogLog_Square.emf -------------------------------------------------------------------------------- /OriginTemplates/Lum-V_LogLog_Square.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Lum-V_LogLog_Square.otp -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/test.opj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/Documentation/MATLAB_Documentation/test.opj -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/Y-Error.otp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/Documentation/MATLAB_Documentation/Y-Error.otp -------------------------------------------------------------------------------- /OriginTemplates/Origin Folder.lnk/target.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Origin Folder.lnk/target.lnk -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/SummaryPlots.opj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/Documentation/MATLAB_Documentation/SummaryPlots.opj -------------------------------------------------------------------------------- /OriginTemplates/Origin Samples Folder.lnk/target.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/OriginTemplates/Origin Samples Folder.lnk/target.lnk -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/PlotXY_example_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbangsund/python_to_originlab/HEAD/Documentation/MATLAB_Documentation/PlotXY_example_data.mat -------------------------------------------------------------------------------- /OriginTemplates/OIMG.INI: -------------------------------------------------------------------------------- 1 | [PNG] 2 | DotsPerInch=600 3 | BitsPerPixel=8 4 | Compression=0 5 | [Export] 6 | TempFormat=1 7 | TempRaster=2 8 | VectorKeepSize=0 9 | [FileDlg] 10 | Preview=0 11 | -------------------------------------------------------------------------------- /OriginTemplates/MenuCommands_E.txt: -------------------------------------------------------------------------------- 1 | [Ver] 2 | 33 3 | [WksPlotMenuMRUList] 4 | Version = 2 5 | 1 = {"33248","","Scatter"} 6 | 2 = {"0","run.section(Plot.ogs, UserPlot, ""C:\Users\JSB\Google Drive\Research\Templates\Origin\Origin2018_UserFiles\LT-ELPL-Lin.otp"" ""Untitled Category"")","LT-ELPL-Lin (Untitled Category)"} 7 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-pfit2l-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings[Spectra1]0500 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Wes_Darjeeling3.oth: -------------------------------------------------------------------------------- 1 | 2 | qKtQAf/oPQGp09IBJEd9AVqRfAE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Wes_Moonrise1.oth: -------------------------------------------------------------------------------- 1 | 2 | csrdAfClsAGMhTYBw7R3AfrQYwE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Wes_Moonrise7.oth: -------------------------------------------------------------------------------- 1 | 2 | IyNVAWFoYAGnW0QBkSspAf/jjwE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Wes_Zissou5.oth: -------------------------------------------------------------------------------- 1 | 2 | AJnmARIlWgHyOBQB37eLAbbDxQE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Wes_Moonrise5.oth: -------------------------------------------------------------------------------- 1 | 2 | 34yQAdjSjgH1viUBPUocAdEwYAGoa0wB 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/temp.oth: -------------------------------------------------------------------------------- 1 | 2 | 5BocATd+uAGYTqMBTa9KAf9/AAHy4WoBAAAAAZmZmQE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/YlOrRd.oth: -------------------------------------------------------------------------------- 1 | 2 | ///MAf/toAH+2XYB/bJMAf2NPAH8TioB4xocAb0AJgGAACYB 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_BuGn.oth: -------------------------------------------------------------------------------- 1 | 2 | 9/z9AeX1+QHM7OYBmdjJAWbCpAFBrnYBI4tFAQBtLAEARBsB 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_Greens.oth: -------------------------------------------------------------------------------- 1 | 2 | 9/z1AeX14AHH6cABodmbAXTEdgFBq10BI4tFAQBtLAEARBsB 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_QualSet1.oth: -------------------------------------------------------------------------------- 1 | 2 | 5BocATd+uAFNr0oB/38AAZhOowHy4WoBAAAAAZmZmQE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_RdBu.oth: -------------------------------------------------------------------------------- 1 | 2 | shgrAdZgTQH0pYIB/dvHAff39wHR5fABksXeAUOTwwEhZqwB 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_Reds.oth: -------------------------------------------------------------------------------- 1 | 2 | //XwAf7g0gH8u6EB/JJyAftqSgHvOywByxgdAaUPFQFnAA0B 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_BluesDown.oth: -------------------------------------------------------------------------------- 1 | 2 | CDBrAQhRnAEhcbUBQpLGAWuu1gGeyuEBxtvvAd7r9wH3+/8B 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_BluesUp.oth: -------------------------------------------------------------------------------- 1 | 2 | 9/v/Ad7r9wHG2+8BnsrhAWuu1gFCksYBIXG1AQhRnAEIMGsB 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Tableau10.oth: -------------------------------------------------------------------------------- 1 | 2 | H3e0Af9/DgEsoCwB1icoAZRnvQGMVksB43fCAX9/fwG8vSIBF77PAQ== 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_PuOr.oth: -------------------------------------------------------------------------------- 1 | 2 | fzsIAbNYBgHgghQB/bhjAf7gtgH39/cB2NrrAbKr0gGAc6wBVCeIAS0ASwE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/colorbrewer2-qualitative.oth: -------------------------------------------------------------------------------- 1 | 2 | AAAAAeQaHAE3frgBTa9KAf9/AAGYTqMB8uFqAZmZmQE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Tableau_Light.oth: -------------------------------------------------------------------------------- 1 | 2 | rsfoAf+7eAGY34oB/5iWAcWw1QHEnJQB97bSAcfHxwHb240BntrlAQ== 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Tableau_Medium.oth: -------------------------------------------------------------------------------- 1 | 2 | cp7OAf+eSgFnv1wB7WZdAa2LyQGoeG4B7ZfKAaKiogHNzF0BbczaAQ== 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/cb2_spectral.oth: -------------------------------------------------------------------------------- 1 | 2 | ngFCAdU+TwH0bUMB/a5hAf7giwH//78B5vWYAavdpAFmwqUBMoi9AV5PogE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/mpl_inferno11.oth: -------------------------------------------------------------------------------- 1 | 2 | AAAEARgMPAFCCmgBahduAZMmZwG8N1QB3VE6AfN2GwH8pQoB9tdGAfz/pAE= 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/Graph/Tableau_ColorBlind.oth: -------------------------------------------------------------------------------- 1 | 2 | AGukAf+ADgGrq6sBWVlZAV+e0QHIUgABiYmJAaLI7AH/vHkBz8/PAQ== 3 | -------------------------------------------------------------------------------- /OriginTemplates/Custom.ogs: -------------------------------------------------------------------------------- 1 | // Filename: Custom.ogs 2 | // Purpose: The Custom Routine button on the standard toolbar will use this code, by calling 3 | // the [Main] section 4 | // Modifications: 5 | 6 | 7 | //////////////////////////////////////////////////////////////////////////////// 8 | // Main Code 9 | //////////////////////////////////////////////////////////////////////////////// 10 | [Main] 11 | type -b $General.Userbutton; 12 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-speedmode-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings5013000132320 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-wtranspose-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings0[Book3]Sheet101001<input>0 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-differentiate-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2[Fulldata]L!(B,E"Normalized1")10220(<input>,<new>)00 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-rnormalize-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2[A]40nm-2000u!2-136.9450000000000004E-6<optional>0<optional><new>0 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-interp1-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2[Book1]Sheet1!E[Book1]Sheet1!(A,D)001::{Auto=1|Auto|1}0.14346256966138243<new>::{DynaUseChck=0}<new>0 3 | -------------------------------------------------------------------------------- /OriginTemplates/MRFiles.ini: -------------------------------------------------------------------------------- 1 | [Recent Exports] 2 | File1=expGraph: ExportPNGtoDesktop 3 | [Recent Graphs] 4 | File1=C:\Users\JSB\Google Drive\Research\Data\Dow Hosts Project\EQEs.ogg 5 | [Recent File List] 6 | File1=C:\Users\JSB\Desktop\test.opju 7 | File2=C:\Users\JSB\Google Drive\Research\Data\Dow Hosts Project\Manuscript\Final Documents\origin-version-of-figures.opj 8 | File3=C:\Users\JSB\Google Drive\Research\Data\Dow Hosts Project\2017-12-12_Dow B RZ Measurement\spectra.opj 9 | File4=C:\Users\JSB\Google Drive\Research\Data\Dow Hosts Project\RZ summary.opj 10 | File5=C:\Users\JSB\Google Drive\Research\Data\Dow Hosts Project\2018-07-20_CVMeasurements\cv-results.opj 11 | File6=C:\Users\JSB\Google Drive\Research\Updates and Slides\Dow Slides\h-only lifetimes.opju 12 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-interp1xy-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2[Book1]Sheet1!(C,D)0::{Auto=1|Auto|1}15::{Auto=1|Auto|1}0.43890000000000001::{Auto=1|Auto|1}2.33000000000000011::{Auto=1|Auto|1}0.870717846861009730(<new>,<new>)::{DynaUseChck=0}<new>0 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-fft_filters-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2[HostAsheet]a24_32v_4_2us!(D,G"Normalized1")0::{Auto=1|Auto|1}78124999.023355901::{Auto=1|Auto|1}234374997.0700677::{Auto=0|Auto|1}10000000::{Auto=1|Auto|1}78124999.023355901::{Auto=1|Auto|1}234374997.0700677::{Auto=1|Auto|1}48.4217467527787091<new>0 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-pef_pptslide-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings40pVoc00000001%H::{Auto=0|End|1}110 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 John Bangsund 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-smooth-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2[Graph1]1!27"60 nm"1::{Auto=1|Auto|1}1.5120875497318098::{Auto=1|Auto|1}1010.1502500.066133736778493046001(<input>,<new>)0 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-template_saveas-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings[Graph2]UserDefinedSCATTERGraph Template (*.otp)<auto><auto>000<Offset>C:\Users\JSB\Documents\OriginLab\2016\User Files\10010 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-fft1-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2[Book1]I=1p4mA_OD=1p5_1to1kbandpass_20n!F::{Auto=1|Auto|1}11001101111100110110000[<input>]<new>::{DynaUseChck=1}[<input>]<new template:=graph>1 3 | -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/sendXYToOrigin.m: -------------------------------------------------------------------------------- 1 | %% Example of sending x-y data to origin 2 | % Note: sometimes Origin likes to freeze and MATLAB will just continue 3 | % running. Ctrl+C doesn't work in this case, so go to task manager and 4 | % manually close Origin. It is also advisable to have Origin closed when 5 | % accessing Origin from MATLAB. 6 | 7 | 8 | % Get path to save origin file 9 | savePath = mfilename('fullpath'); 10 | subtract = length(mfilename()); 11 | savePath = savePath(1:end-subtract); % subtract off length of .m filename 12 | 13 | % load data 14 | load PlotXY_example_data.mat 15 | 16 | % Select a template 17 | % Origin typically saves templates in your user files directory 18 | % e.g. 'C:\Users\JSB\Documents\OriginLab\2016\User Files\Y-Error.otp' 19 | templatePath = [savePath 'Y-Error.otp']; 20 | % Alternatively you can use built-in templates: 21 | % templatePath = 'Scatter'; 22 | 23 | % Name the .opj file 24 | opj_filename = 'SummaryPlots'; 25 | 26 | % Selecting 'New' will overwrite a .opj file with the same name 27 | % Selecting 'Existing' will add new graphs/workbooks to an existing .opj 28 | new_or_existing = 'New'; % 'Existing' or 'New' 29 | symbol_or_line = 'symbol+line'; % 'symbol', 'line', or 'symbol+line' 30 | 31 | % Make sure metadataHeader is a cell array of strings 32 | metadataHeader = cellfun(@(x) num2str(x),metadataHeader,'UniformOutput',false); 33 | 34 | % Send everything over to the origin plot function 35 | % Note: y_error is optional and you must either have 1 x column (same for 36 | % all y data) or the same number of x columns as y data 37 | OriginPlotXY(templatePath, savePath, opj_filename, new_or_existing, symbol_or_line, ... 38 | legendEntries, metadataHeader, x_units, y_units, x, y, y_error) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | oledpy/dbHelper.py 103 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-merge_graph-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings6Graph5 3 | Graph6 4 | Graph71131001000050105510011.417.97299999999999990010::{Auto=1|Enable Substitution|0}Graph##00 5 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-merge_graph-merge_test_1.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings6Graph9 3 | ExcitonDensity 4 | Graph31131001000055181057110.699999999999999240213::{Auto=1|Enable Substitution|0}%(v$))10 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # python_to_originlab 2 | ## Overview 3 | Functions in python to automate sending data and basic plotting functions in OriginLab. The function matplotlib_to_origin can convert matplotlib figures directly to origin graphs. 4 | 5 | The function matplotlib_to_origin will try it's best to convert a matplotlib figure to an origin graph, extracting data and line properties from the figure and axis handles. It's by no means perfect, but allows for data to quickly be transferred from the python environment to OriginLab for further tweaking and sharing (with, e.g., advisors who demand you use Origin). 6 | ![Example Origin Plot](https://github.com/jsbangsund/python_to_originlab/blob/master/example.png) 7 | 8 | ## Dependencies 9 | OriginLab must be installed, and must have the win32com python package (https://anaconda.org/anaconda/pywin32). 10 | [OriginExt](https://pypi.org/project/OriginExt/#description) is also used, and can be installed with: 11 | `pip install originext` 12 | 13 | ## Other notes 14 | Origin color increment lists (.oth files) follow the color series in https://jiffyclub.github.io/palettable/, and can be found in the folder "\OriginTemplates\Themes\Graph". 15 | 16 | There are a number of small syntax differences between versions. I have tested this code on OriginLab 2016 and 2018, but don't know about compatibility outside of those versions. 17 | 18 | OriginLab's default directory for user templates is (with appropriate version year selected): 19 | C:\Users\username\Documents\OriginLab\2016\User Files 20 | 21 | ## Documentation 22 | OriginLab has fairly spotty documentation, but the two main documentation sources are for the Automation Server, and for LabTalk commands. LabTalk seems to be a much older and more thoroughly developed/documented language, so more complicated and specific commands can be achieved with this. 23 | 24 | - [Automation Server Docs](https://www.originlab.com/doc/COM/Classes/ApplicationSI) 25 | - [LabTalk Docs](https://www.originlab.com/doc/LabTalk/guide) 26 | 27 | 28 | ## Other Resources 29 | - https://github.com/swharden/PyOriginTools 30 | - [OriginExt Package](https://pypi.org/project/OriginExt/) 31 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-batchProcess-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings1C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\PTI\transient_analysis_template.ogw-11C:\Users\JSB\Documents\OriginLab\2016\User Files\001C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_15v_4.csv 3 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_18v_4.csv 4 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_20v_4.csv 5 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_20v_4_2us.csv 6 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_22v_4.csv 7 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_22v_4_2us.csv 8 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_25v_4.csv 9 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co3_28v_4_2us.csv 10 | C:\Users\JSB\Google Drive\Research\Data\0530 - Dow Devices\device set 2\transient el\170730\A+B\Ch4\co32_28v_4.csv::{DynaUseChck=0}[Graph1]1!1"15 V"None<auto>ImportWizard<auto><none>::{DynaUseChck=0}[Summary]Results!011000 11 | -------------------------------------------------------------------------------- /Numpy_to_Originlab_example.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import numpy as np\n", 10 | "import matplotlib.pyplot as plt\n", 11 | "import os\n", 12 | "%matplotlib inline\n", 13 | "import win32com.client\n", 14 | "import py2origin as py2o" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 2, 20 | "metadata": {}, 21 | "outputs": [ 22 | { 23 | "name": "stdout", 24 | "output_type": "stream", 25 | "text": [ 26 | "data\n", 27 | "None\n" 28 | ] 29 | } 30 | ], 31 | "source": [ 32 | "x = np.arange(-10,10.1,0.1)\n", 33 | "y = np.cos(x)\n", 34 | "y2 = np.sin(x)\n", 35 | "y3 = np.tan(x)\n", 36 | "\n", 37 | "data = np.array((x,y,y2))\n", 38 | "header = ['x','cos(x)','sin(x)']\n", 39 | "origin,wb,ws = py2o.numpy_to_origin(\n", 40 | " data,column_axis=0,\n", 41 | " long_names=header,\n", 42 | " origin_version=2018,\n", 43 | " worksheet_name='Trig functions',\n", 44 | " workbook_name='data')" 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 3, 50 | "metadata": {}, 51 | "outputs": [ 52 | { 53 | "data": { 54 | "text/plain": [ 55 | "'Trig'" 56 | ] 57 | }, 58 | "execution_count": 3, 59 | "metadata": {}, 60 | "output_type": "execute_result" 61 | } 62 | ], 63 | "source": [ 64 | "py2o.createGraph_multiwks(origin,\n", 65 | " 'Trig','Spectra_Wide.otp',\n", 66 | " os.path.abspath('OriginTemplates'),\n", 67 | " [ws],[0,0],[1,2],['Sym','Line'])" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": 4, 73 | "metadata": {}, 74 | "outputs": [ 75 | { 76 | "data": { 77 | "text/plain": [ 78 | "True" 79 | ] 80 | }, 81 | "execution_count": 4, 82 | "metadata": {}, 83 | "output_type": "execute_result" 84 | } 85 | ], 86 | "source": [ 87 | "origin.Exit()" 88 | ] 89 | } 90 | ], 91 | "metadata": { 92 | "kernelspec": { 93 | "display_name": "Python (oled)", 94 | "language": "python", 95 | "name": "oled" 96 | }, 97 | "language_info": { 98 | "codemirror_mode": { 99 | "name": "ipython", 100 | "version": 3 101 | }, 102 | "file_extension": ".py", 103 | "mimetype": "text/x-python", 104 | "name": "python", 105 | "nbconvert_exporter": "python", 106 | "pygments_lexer": "ipython3", 107 | "version": "3.7.3" 108 | }, 109 | "toc": { 110 | "base_numbering": 1, 111 | "nav_menu": {}, 112 | "number_sections": true, 113 | "sideBar": true, 114 | "skip_h1_title": false, 115 | "title_cell": "Table of Contents", 116 | "title_sidebar": "Contents", 117 | "toc_cell": false, 118 | "toc_position": {}, 119 | "toc_section_display": true, 120 | "toc_window_display": false 121 | } 122 | }, 123 | "nbformat": 4, 124 | "nbformat_minor": 2 125 | } 126 | -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/CreatePlotInOrigin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % This m-file shows a basic example of how to communicate between a MATLAB client and an Origin Server application. 4 | % This example does the following: 5 | % -> Connects to Origin server application if an instance exists, or launches a new instance of Origin server 6 | % -> Loads a previously customized Origin Project file which has a worksheet and a custom graph 7 | % -> Sends some data over to the Origin worksheet, which then updates the graph 8 | % -> Rescales the graph and copies the graph image to the system clipboard 9 | % 10 | % For documentation on all methods and properties supported by the Origin Automation Server, please refer to the 11 | % Programming Help File, and the topic "Calling Origin from Other Applications (Automation Server Support)". 12 | % 13 | % Note: This m-file was tested only in MATLAB 6.1 14 | % You may need to download a new DLL from the MathWorks website: 15 | % ftp://ftp.mathworks.com/pub/tech-support/solutions/s29502/actxcli.dll 16 | % and replace the older DLL found in the following MATLAB subfolder 17 | % $MATLAB\toolbox\matlab\winfun\@activex\private\actxcli.dll 18 | % to fix a bug in MATLAB ActiveX 19 | % 20 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 21 | % 22 | function CreatePlotInOrigin() 23 | % 24 | % Obtain Origin COM Server object 25 | % This will connect to an existing instance of Origin, or create a new one if none exist 26 | originObj=actxserver('Origin.ApplicationSI'); 27 | 28 | % Make the Origin session visible 29 | invoke(originObj, 'Execute', 'doc -mc 1;'); 30 | 31 | % Clear "dirty" flag in Origin to suppress prompt for saving current project 32 | % You may want to replace this with code to handling of saving current project 33 | invoke(originObj, 'IsModified', 'false'); 34 | 35 | % Load the custom project CreateOriginPlot.OPJ found in Samples area of Origin installation 36 | invoke(originObj, 'Execute', 'syspath$=system.path.program$;'); 37 | strPath=''; 38 | strPath = invoke(originObj, 'LTStr', 'syspath$'); 39 | invoke(originObj, 'Load', strcat(strPath, 'Samples\COM Server and Client\Matlab\CreatePlotInOrigin.OPJ')); 40 | 41 | % Create some data to send over to Origin - create three vectors 42 | % This can be replaced with real data such as result of computation in MATLAB 43 | mdata = [0.1:0.1:3; 10 * sin(0.1:0.1:3); 20 * cos(0.1:0.1:3)]; 44 | % Transpose the data so that it can be placed in Origin worksheet columns 45 | mdata = mdata'; 46 | % Send this data over to the Data1 worksheet 47 | invoke(originObj, 'PutWorksheet', 'Data1', mdata); 48 | 49 | % Rescale the two layers in the graph and copy graph to clipboard 50 | invoke(originObj, 'Execute', 'page.active = 1; layer - a; page.active = 2; layer - a;'); 51 | % '4' makes it an OLE object (clicking opens origin) 52 | invoke(originObj, 'CopyPage', 'Graph1', '4'); 53 | 54 | % You can now get the graph image from clipboard and paste in PowerPoint etc. 55 | % 56 | % end -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-DescStats-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2131072000101100001000000000000100101000090 95 990000::{Auto=1||1}11Name<auto>1<source> MetaMeta<new>DescStatsOnCols100<none><source> MetaMeta<new>DescStatsQuantities111005129738085169455200100 3 | -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/example_doubleY_plot.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | 3 | % Create Double Y JV and Luminance graph 4 | templatePath = 'C:\Users\JSB\Documents\OriginLab\2016\User Files\JV-Lum-LogLog-Line.otp'; 5 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Graph Name 6 | graph_JV_Lum = invoke(originObj, 'CreatePage', 3, 'JV-Luminance' , templatePath); 7 | 8 | 9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 | 11 | % First the JV layer (Layer 1) 12 | invoke(originObj, 'Execute', 'layer -s 1;'); 13 | % Find the layer 14 | graphLayer_JV_Lum = invoke(originObj, 'FindGraphLayer', graph_JV_Lum); 15 | % Make Layer 1 active 16 | 17 | % Get dataplot collection from the graph layer 18 | dataplots_JV = invoke(graphLayer_JV_Lum, 'DataPlots'); 19 | 20 | % Add data column by column to the graph 21 | for i = 1 : (size(luminanceArray,2) - 1)/2 22 | 23 | % Create a data range 24 | dr = invoke(originObj, 'NewDataRange'); 25 | 26 | % Add data to data range 27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 28 | invoke(dr, 'Add', 'X', wkSheet_lum, 0 , 0 , -1, 0 ); % x is voltage 29 | invoke(dr, 'Add', 'Y', wkSheet_lum, 0 , 2*i-1 , -1, 2*i-1 ); 30 | 31 | % Add data plot to graph layer 32 | % 200 -- line 33 | % 201 -- symbol 34 | % 202 -- symbol+line 35 | invoke(dataplots_JV, 'Add', dr, 200); 36 | end 37 | 38 | % Group data (This allows colors to be automatically incremented and a 39 | % single legend entry to be created for all the data sets with the 40 | % same legend entry) 41 | invoke(graphLayer_JV_Lum, 'Execute', 'layer -g;'); 42 | 43 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 44 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 45 | invoke(graphLayer_JV_Lum, 'Execute', 'legend -r;'); 46 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 47 | 48 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 49 | % Now luminance layer 50 | % Make Layer 2 active 51 | invoke(originObj, 'Execute', 'layer -s 2;'); 52 | % Now find the layer 53 | graphLayer_JV_Lum = invoke(originObj, 'FindGraphLayer', graph_JV_Lum); 54 | % Get dataplot collection from the graph layer 55 | dataplots_lum = invoke(graphLayer_JV_Lum, 'DataPlots'); 56 | 57 | % Add data column by column to the graph 58 | for i = 1 : (size(luminanceArray,2) - 1)/2 59 | 60 | % Create a data range 61 | dr = invoke(originObj, 'NewDataRange'); 62 | 63 | % Add data to data range 64 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 65 | invoke(dr, 'Add', 'X', wkSheet_lum, 0 , 0 , -1, 0 ); % x is voltage 66 | invoke(dr, 'Add', 'Y', wkSheet_lum, 0 , 2*i , -1, 2*i ); 67 | 68 | % Add data plot to graph layer 69 | % 200 -- line 70 | % 201 -- symbol 71 | % 202 -- symbol+line 72 | invoke(dataplots_lum, 'Add', dr, 200); 73 | end 74 | 75 | % Group data (This allows colors to be automatically incremented and a 76 | % single legend entry to be created for all the data sets with the 77 | % same legend entry) 78 | invoke(graphLayer_JV_Lum, 'Execute', 'layer -g;'); -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/MATLABCallOrigin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % This m-file shows some base operations between a MATLAB client and an 3 | % Origin Server application. 4 | % 5 | % This example does the following: 6 | % -> Connect to an existing Origin server application or create a new 7 | % one if none exists. 8 | % -> Create workbook and find workseet, and then change worksheet name. 9 | % -> Get columns from worksheet, and set column's type, and set data 10 | % to column. 11 | % -> Create graph and add x-y-error data as scatter line plot to graph. 12 | % -> Customize plot, such as axes' label, legend, range, etc. 13 | % -> Save project. 14 | % 15 | % Usage: 16 | % x = [0.1:0.1:3; 10 * sin(0.1:0.1:3); 20 * cos(0.1:0.1:3)]'; 17 | % MATLABCallOrigin(x); 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | 20 | function MATLABCallOrigin(x) 21 | 22 | % Obtain Origin COM Server object 23 | % Connect to an existing instance of Origin 24 | % or create a new one if none exists 25 | 26 | originObj = actxserver('Origin.ApplicationSI'); 27 | 28 | % Make the Origin session visible 29 | invoke(originObj, 'Execute', 'doc -mc 1;'); 30 | 31 | % Clear "dirty" flag in Origin to suppress prompt 32 | % for saving current project 33 | invoke(originObj, 'IsModified', 'false'); 34 | 35 | % Create a workbook 36 | strBook = invoke(originObj, 'CreatePage', 2, '', 'Origin'); 37 | 38 | % Find the worksheet 39 | wks = invoke(originObj, 'FindWorksheet', strBook); 40 | 41 | % Rename the worksheet to "MySheet" 42 | invoke(wks, 'Name', 'MySheet'); 43 | 44 | % Set 3 columns 45 | invoke(wks, 'Cols', 6); 46 | 47 | % Get column collection in the worksheet 48 | cols = invoke(wks, 'Columns'); 49 | 50 | % Get the columns 51 | colx = invoke(cols, 'Item', uint8(0)); 52 | coly = invoke(cols, 'Item', uint8(1)); 53 | colerr = invoke(cols, 'Item', uint8(3)); 54 | 55 | % Set column type 56 | invoke(colx, 'Type', 3); % x column 57 | invoke(coly, 'Type', 0); % y column 58 | invoke(colerr, 'Type', 2); % y error 59 | 60 | % Set data to the columns 61 | invoke(wks, 'SetData', x, 0, 0); 62 | 63 | % Create a graph 64 | strGraph = invoke(originObj, 'CreatePage', 3, '', 'Origin'); 65 | 66 | % Find the graph layer 67 | gl = invoke(originObj, 'FindGraphLayer', strGraph); 68 | 69 | % Get dataplot collection from the graph layer 70 | dps = invoke(gl, 'DataPlots'); 71 | 72 | % Create a data range 73 | dr = invoke(originObj, 'NewDataRange'); 74 | 75 | % Add data to data range 76 | invoke(dr, 'Add', 'X', wks, 0, 0, -1, 0); 77 | invoke(dr, 'Add', 'Y', wks, 0, 1, -1, 1); 78 | invoke(dr, 'Add', 'ED', wks, 0, 2, -1, 2); 79 | 80 | % Add data plot to graph layer 81 | invoke(dps, 'Add', dr, 202); % 202 for symbol+line plot 82 | 83 | % Rescale the graph layer 84 | invoke(gl, 'Execute', 'rescale;'); 85 | 86 | % Change the bottom x' title 87 | invoke(gl, 'Execute', 'xb.text$ = "Channel";'); 88 | % Change the left y's title 89 | invoke(gl, 'Execute', 'yl.text$ = "Amplitude";'); 90 | 91 | %show the top and right axes 92 | invoke(gl, 'Execute', 'range ll = !;'); 93 | invoke(gl, 'Execute', 'll.x2.showAxes=3;'); 94 | invoke(gl, 'Execute', 'll.y2.showAxes=3;'); 95 | 96 | %set the x axis scale 97 | invoke(gl, 'Execute', 'll.x.from=0;'); 98 | invoke(gl, 'Execute', 'll.x.to=3;'); 99 | 100 | %set the x axis Major tick increment. 101 | invoke(gl, 'Execute', 'll.x.inc=10;'); 102 | 103 | %delete the legend 104 | invoke(gl, 'Execute', 'label -r legend;'); 105 | 106 | %Save the current project using the specified path and filename 107 | invoke(originObj, 'Execute', 'save C:\Users\JSB\Google Drive\Research\Scripts\MATLABCallOrigin\MatlabCallOrigin.opj'); 108 | 109 | % Release 110 | release(originObj); -------------------------------------------------------------------------------- /OriginTemplates/SYSTEM.CNF: -------------------------------------------------------------------------------- 1 | SYSTEM.RESULTS.AUTOOPEN=1; 2 | SYSTEM.RESULTS.TABSIZE=-1; 3 | SYSTEM.RESULTS.VIEWMODE=2; 4 | SYSTEM.COLORMAP.INCLUDELEVELSANDCOLORONLY=1; 5 | SYSTEM.DATADISPLAY.AUTOFIT=1; 6 | SYSTEM.DATADISPLAY.BKCOLOR=0; 7 | SYSTEM.DATADISPLAY.DOCKING=1; 8 | SYSTEM.DATADISPLAY.FONT$=Default; 9 | SYSTEM.DATADISPLAY.RESIZE=2; 10 | SYSTEM.DATADISPLAY.TXTCOLOR=2; 11 | SYSTEM.DATADISPLAY.MINFONTSIZE=10; 12 | SYSTEM.DATADISPLAY.MAXFONTSIZE=-1; 13 | SYSTEM.DATAINFO.AUTOFIT=1; 14 | SYSTEM.DATAINFO.BKCOLOR=18; 15 | SYSTEM.DATAINFO.DOCKING=1; 16 | SYSTEM.DATAINFO.FONT$=Segoe UI; 17 | SYSTEM.DATAINFO.RESIZE=2; 18 | SYSTEM.DATAINFO.TXTCOLOR=0; 19 | SYSTEM.DATAINFO.MINFONTSIZE=10; 20 | SYSTEM.DATAINFO.MAXFONTSIZE=16; 21 | SYSTEM.LINE.COLOR=1; 22 | SYSTEM.LINE.WIDTH=0.5; 23 | SYSTEM.LINE.LINETYPE=0; 24 | SYSTEM.LINE.ARROWPOSITION=0; 25 | SYSTEM.LINE.ARROWBEGINWIDTH=5; 26 | SYSTEM.LINE.ARROWBEGINLENGTH=10; 27 | SYSTEM.LINE.ARROWBEGINSHAPE=0; 28 | SYSTEM.LINE.ARROWENDWIDTH=5; 29 | SYSTEM.LINE.ARROWENDLENGTH=10; 30 | SYSTEM.LINE.ARROWENDSHAPE=0; 31 | SYSTEM.LINE.TRANSPARENCY=0; 32 | SYSTEM.LINE4.COLOR=1; 33 | SYSTEM.LINE4.WIDTH=0.5; 34 | SYSTEM.LINE4.LINETYPE=0; 35 | SYSTEM.LINE4.ARROWPOSITION=0; 36 | SYSTEM.LINE4.ARROWBEGINWIDTH=5; 37 | SYSTEM.LINE4.ARROWBEGINLENGTH=10; 38 | SYSTEM.LINE4.ARROWBEGINSHAPE=0; 39 | SYSTEM.LINE4.ARROWENDWIDTH=5; 40 | SYSTEM.LINE4.ARROWENDLENGTH=10; 41 | SYSTEM.LINE4.ARROWENDSHAPE=0; 42 | SYSTEM.LINE4.TRANSPARENCY=0; 43 | SYSTEM.POLYLINE.COLOR=1; 44 | SYSTEM.POLYLINE.WIDTH=0.5; 45 | SYSTEM.POLYLINE.LINETYPE=0; 46 | SYSTEM.POLYLINE.ARROWPOSITION=0; 47 | SYSTEM.POLYLINE.ARROWBEGINWIDTH=5; 48 | SYSTEM.POLYLINE.ARROWBEGINLENGTH=10; 49 | SYSTEM.POLYLINE.ARROWBEGINSHAPE=0; 50 | SYSTEM.POLYLINE.ARROWENDWIDTH=5; 51 | SYSTEM.POLYLINE.ARROWENDLENGTH=10; 52 | SYSTEM.POLYLINE.ARROWENDSHAPE=0; 53 | SYSTEM.POLYLINE.TRANSPARENCY=0; 54 | SYSTEM.RECT.COLOR=1; 55 | SYSTEM.RECT.WIDTH=0.5; 56 | SYSTEM.RECT.LINETYPE=0; 57 | SYSTEM.RECT.BACKCOLOR=19; 58 | SYSTEM.RECT.FORECOLOR=1; 59 | SYSTEM.RECT.FILLPATTERN=0; 60 | SYSTEM.RECT.FILLWIDTH=1; 61 | SYSTEM.RECT.TRANSPARENCY=0; 62 | SYSTEM.RECT.FILLPATTERNSTRETCH=0; 63 | SYSTEM.RECT.FILLPATTERNPROPORTIONAL=1; 64 | SYSTEM.RECT.FILLPATTERNXSCALE=1; 65 | SYSTEM.RECT.FILLPATTERNYSCALE=1; 66 | SYSTEM.RECT.FILLPATTERNXOFFSET=0; 67 | SYSTEM.RECT.FILLPATTERNYOFFSET=0; 68 | SYSTEM.CIRCLE.COLOR=1; 69 | SYSTEM.CIRCLE.WIDTH=0.5; 70 | SYSTEM.CIRCLE.LINETYPE=0; 71 | SYSTEM.CIRCLE.BACKCOLOR=19; 72 | SYSTEM.CIRCLE.FORECOLOR=1; 73 | SYSTEM.CIRCLE.FILLPATTERN=0; 74 | SYSTEM.CIRCLE.FILLWIDTH=1; 75 | SYSTEM.CIRCLE.TRANSPARENCY=0; 76 | SYSTEM.CIRCLE.FILLPATTERNSTRETCH=0; 77 | SYSTEM.CIRCLE.FILLPATTERNPROPORTIONAL=1; 78 | SYSTEM.CIRCLE.FILLPATTERNXSCALE=1; 79 | SYSTEM.CIRCLE.FILLPATTERNYSCALE=1; 80 | SYSTEM.CIRCLE.FILLPATTERNXOFFSET=0; 81 | SYSTEM.CIRCLE.FILLPATTERNYOFFSET=0; 82 | SYSTEM.POLYGON.COLOR=1; 83 | SYSTEM.POLYGON.WIDTH=0.5; 84 | SYSTEM.POLYGON.LINETYPE=0; 85 | SYSTEM.POLYGON.BACKCOLOR=19; 86 | SYSTEM.POLYGON.FORECOLOR=1; 87 | SYSTEM.POLYGON.FILLPATTERN=0; 88 | SYSTEM.POLYGON.FILLWIDTH=1; 89 | SYSTEM.POLYGON.TRANSPARENCY=0; 90 | SYSTEM.POLYGON.FILLPATTERNSTRETCH=0; 91 | SYSTEM.POLYGON.FILLPATTERNPROPORTIONAL=1; 92 | SYSTEM.POLYGON.FILLPATTERNXSCALE=1; 93 | SYSTEM.POLYGON.FILLPATTERNYSCALE=1; 94 | SYSTEM.POLYGON.FILLPATTERNXOFFSET=0; 95 | SYSTEM.POLYGON.FILLPATTERNYOFFSET=0; 96 | SYSTEM.ANNOTATION.MODE=0; 97 | SYSTEM.ANNOTATION.CUSTOMLABEL$=""; 98 | SYSTEM.ANNOTATION.MODEXYZ=0; 99 | SYSTEM.ANNOTATION.CUSTOMLABELXYZ$=""; 100 | SYSTEM.ANNOTATION.LABELNAME$=""; 101 | SYSTEM.ANNOTATION.LABELCOLOR=0; 102 | SYSTEM.ANNOTATION.LABELSIZE=22; 103 | SYSTEM.ANNOTATION.TABSIZE=8; 104 | SYSTEM.ANNOTATION.ROTATION=0; 105 | SYSTEM.ANNOTATION.TEXTCNTRL=0; 106 | SYSTEM.ANNOTATION.VERBATIM=0; 107 | SYSTEM.ANNOTATION.JUSTIFY=17; 108 | SYSTEM.ANNOTATION.SHADOWSTYLE=0; 109 | SYSTEM.ANNOTATION.FILLCOLOR=-4; 110 | SYSTEM.ANNOTATION.BORDERWIDTH=0; 111 | SYSTEM.ANNOTATION.BORDERCOLOR=-4; 112 | SYSTEM.ANNOTATION.SHADOWWIDTH=0; 113 | SYSTEM.ANNOTATION.SHADOWCOLOR=-9; 114 | SYSTEM.ANNOTATION.MARGINLEFT=12.4; 115 | SYSTEM.ANNOTATION.MARGINRIGHT=12.4; 116 | SYSTEM.ANNOTATION.MARGINTOP=12.4; 117 | SYSTEM.ANNOTATION.MARGINBOTTOM=12.4; 118 | SYSTEM.ANNOTATION.LEADERLINETHRESHOLD=0; 119 | SYSTEM.ANNOTATION.LEADERLINECONNECTTYPE=0; 120 | SYSTEM.ANNOTATION.LEADERLINECONNECTPERCENT=0; 121 | SYSTEM.ANNOTATION.LEADERLINESITE1GAP=1; 122 | SYSTEM.ANNOTATION.LEADERLINESITE2GAP=0; 123 | SYSTEM.ANNOTATION.TETHERCOLOR=0; 124 | SYSTEM.ANNOTATION.TETHERSTYLE=0; 125 | SYSTEM.ANNOTATION.TETHERWIDTH=0.5; 126 | SYSTEM.ANNOTATION.BEGINARROWSTYLE=0; 127 | SYSTEM.ANNOTATION.BEGINARROWWIDTH=5; 128 | SYSTEM.ANNOTATION.BEGINARROWLENGTH=10; 129 | SYSTEM.ANNOTATION.ENDARROWSTYLE=0; 130 | SYSTEM.ANNOTATION.ENDARROWWIDTH=5; 131 | SYSTEM.ANNOTATION.ENDARROWLENGTH=10; 132 | SYSTEM.ANNOTATION.STATES=0; 133 | SYSTEM.ANNOTATION.UNITS=3; 134 | SYSTEM.ANNOTATION.POSJUSTIFY=0; 135 | SYSTEM.ANNOTATION.POSOFFSETX=0/0; 136 | SYSTEM.ANNOTATION.POSOFFSETY=0/0; 137 | SYSTEM.ANNOTATION.TRANSPARENCY=0; 138 | SYSTEM.DEBUG=0; 139 | SYSTEM.EXPLORER=1; 140 | SYSTEM.EXTBACKCOLOR=1; 141 | SYSTEM.PAGECOL=0; 142 | SYSTEM.PAGEROW=0; 143 | SYSTEM.TEMPLATEPATH=0; 144 | SYSTEM.WINVIEWFSIZE=1; 145 | SYSTEM.ShowOneNameInPE=0; 146 | SYSTEM.LID=0; 147 | SYSTEM.REPORTLANGUAGE=0; 148 | -------------------------------------------------------------------------------- /OriginTemplates/template.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-addtool_quickfit-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings0Linear1-117.548.750.::{DynaUseChck=0}Gadget Quick Fit00.0.0.0.0.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1111111111111111111111111111111120.-9.-11.0.1.0000.1.2.1.1.1111-12.[Qkfit]Result0.1.4.1.4.0.1.2.1.1.1111-11.10000::{Auto=1}-600::{Auto=1}60000. 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-expGraph-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings100Graph1::{Auto=1|Enable Substitution|0}<long name>C:\Users\JSB\Desktop3<Original>1::{Auto=0|Use Tools Options|1}-102506000::{Auto=0|Use Source|1}-10Width 7.00 inch x Height 6.00 inchWidth: 7.00 inch, Height: 6.00 inch00::{Auto=1}7::{Auto=1}6Width 1050 x Height 900-1-1-120RGB2150-1None11-11200.23999999999999999-11300-11-130024-bit Color0-1300RGB256 ColorsLZW-1300256 Colors-1-10000272-16410-100200-1300256 Colors-1Standard Options (ANSI)NormalDevice-1Standard Options (Text DXF)NormalInches-1300256 Colors-1150256 Colors0-1300256 Colors0-1300256 Colors0-11-100000100None372720 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-expGraph-ExportPNGtoDesktop.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings100Graph4 - t50 vs M-EML thickness::{Auto=1|Enable Substitution|0}<long name>C:\Users\JSB\Desktop3<Original>1::{Auto=0|Use Tools Options|1}-102506000::{Auto=0|Use Source|1}-10Width 11.41 inch x Height 7.97 inchWidth: 11.41 inch, Height: 7.97 inch00::{Auto=1}11.41::{Auto=1}7.9730000000000008Width 6846 x Height 4784-1-1-120RGB2150-1None11-11200.23999999999999999-11300-11-130024-bit Color0-1300RGB256 ColorsLZW-1300256 Colors-1-10000272-16410-100200-1300256 Colors-1Standard Options (ANSI)NormalDevice-1Standard Options (Text DXF)NormalInches-1300256 Colors-1600256 Colors0-1300256 Colors0-1300256 Colors0-11-100000100None372720 3 | -------------------------------------------------------------------------------- /Communicating with origin examples.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import OriginExt" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 20, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "origin = OriginExt.ApplicationSI()\n", 19 | "origin.Visible = origin.MAINWND_SHOW" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 6, 25 | "metadata": {}, 26 | "outputs": [ 27 | { 28 | "data": { 29 | "text/plain": [ 30 | "True" 31 | ] 32 | }, 33 | "execution_count": 6, 34 | "metadata": {}, 35 | "output_type": "execute_result" 36 | } 37 | ], 38 | "source": [ 39 | "origin.NewProject()" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": 8, 45 | "metadata": {}, 46 | "outputs": [ 47 | { 48 | "data": { 49 | "text/plain": [ 50 | "9.510195" 51 | ] 52 | }, 53 | "execution_count": 8, 54 | "metadata": {}, 55 | "output_type": "execute_result" 56 | } 57 | ], 58 | "source": [ 59 | "origin.GetLTVar(\"@V\")" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": 9, 65 | "metadata": {}, 66 | "outputs": [ 67 | { 68 | "data": { 69 | "text/plain": [ 70 | "True" 71 | ] 72 | }, 73 | "execution_count": 9, 74 | "metadata": {}, 75 | "output_type": "execute_result" 76 | } 77 | ], 78 | "source": [ 79 | "origin.IsModified" 80 | ] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "execution_count": 10, 85 | "metadata": {}, 86 | "outputs": [ 87 | { 88 | "data": { 89 | "text/plain": [ 90 | "True" 91 | ] 92 | }, 93 | "execution_count": 10, 94 | "metadata": {}, 95 | "output_type": "execute_result" 96 | } 97 | ], 98 | "source": [ 99 | "origin.Exit()" 100 | ] 101 | }, 102 | { 103 | "cell_type": "code", 104 | "execution_count": 22, 105 | "metadata": { 106 | "scrolled": true 107 | }, 108 | "outputs": [ 109 | { 110 | "data": { 111 | "text/plain": [ 112 | "" 113 | ] 114 | }, 115 | "execution_count": 22, 116 | "metadata": {}, 117 | "output_type": "execute_result" 118 | } 119 | ], 120 | "source": [ 121 | "import os\n", 122 | "import py2origin as py2o\n", 123 | "import imp\n", 124 | "imp.reload(py2o)" 125 | ] 126 | }, 127 | { 128 | "cell_type": "code", 129 | "execution_count": 21, 130 | "metadata": {}, 131 | "outputs": [ 132 | { 133 | "data": { 134 | "text/plain": [ 135 | "True" 136 | ] 137 | }, 138 | "execution_count": 21, 139 | "metadata": {}, 140 | "output_type": "execute_result" 141 | } 142 | ], 143 | "source": [ 144 | "origin.Execute(\"save \" + os.path.join(os.getcwd(),'test.opj'))" 145 | ] 146 | }, 147 | { 148 | "cell_type": "code", 149 | "execution_count": 23, 150 | "metadata": {}, 151 | "outputs": [], 152 | "source": [ 153 | "py2o.save_project(origin,'test',os.getcwd())" 154 | ] 155 | }, 156 | { 157 | "cell_type": "code", 158 | "execution_count": 24, 159 | "metadata": {}, 160 | "outputs": [ 161 | { 162 | "data": { 163 | "text/plain": [ 164 | "True" 165 | ] 166 | }, 167 | "execution_count": 24, 168 | "metadata": {}, 169 | "output_type": "execute_result" 170 | } 171 | ], 172 | "source": [ 173 | "origin.Execute(\"doc -d;\")" 174 | ] 175 | }, 176 | { 177 | "cell_type": "code", 178 | "execution_count": 25, 179 | "metadata": {}, 180 | "outputs": [ 181 | { 182 | "data": { 183 | "text/plain": [ 184 | "True" 185 | ] 186 | }, 187 | "execution_count": 25, 188 | "metadata": {}, 189 | "output_type": "execute_result" 190 | } 191 | ], 192 | "source": [ 193 | "origin.Exit()" 194 | ] 195 | }, 196 | { 197 | "cell_type": "code", 198 | "execution_count": 29, 199 | "metadata": {}, 200 | "outputs": [ 201 | { 202 | "name": "stdout", 203 | "output_type": "stream", 204 | "text": [ 205 | "pass\n" 206 | ] 207 | } 208 | ], 209 | "source": [ 210 | "a = [1,1]\n", 211 | "i = 1\n", 212 | "if (not a is None) and (len(a)>i):\n", 213 | " print('pass')\n", 214 | "else:\n", 215 | " print('nope')" 216 | ] 217 | }, 218 | { 219 | "cell_type": "code", 220 | "execution_count": 19, 221 | "metadata": {}, 222 | "outputs": [ 223 | { 224 | "data": { 225 | "text/plain": [ 226 | "'project'" 227 | ] 228 | }, 229 | "execution_count": 19, 230 | "metadata": {}, 231 | "output_type": "execute_result" 232 | } 233 | ], 234 | "source": [ 235 | "a = 'project.opj'\n", 236 | "a=a.replace('.opj','')\n", 237 | "a" 238 | ] 239 | } 240 | ], 241 | "metadata": { 242 | "kernelspec": { 243 | "display_name": "Python (oled)", 244 | "language": "python", 245 | "name": "oled" 246 | }, 247 | "language_info": { 248 | "codemirror_mode": { 249 | "name": "ipython", 250 | "version": 3 251 | }, 252 | "file_extension": ".py", 253 | "mimetype": "text/x-python", 254 | "name": "python", 255 | "nbconvert_exporter": "python", 256 | "pygments_lexer": "ipython3", 257 | "version": "3.7.3" 258 | }, 259 | "toc": { 260 | "base_numbering": 1, 261 | "nav_menu": {}, 262 | "number_sections": true, 263 | "sideBar": true, 264 | "skip_h1_title": false, 265 | "title_cell": "Table of Contents", 266 | "title_sidebar": "Contents", 267 | "toc_cell": false, 268 | "toc_position": {}, 269 | "toc_section_display": true, 270 | "toc_window_display": false 271 | } 272 | }, 273 | "nbformat": 4, 274 | "nbformat_minor": 2 275 | } 276 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-expGraph-ExportPNG.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings100Graph61 - JV-Animation::{Auto=1|Enable Substitution|0}<long name>C:\Users\JSB\Google Drive\MOE lab\CounterionPublication\OriginFiles\ExportedFigures3<Original>1::{Auto=0|Use Tools Options|1}-102506000::{Auto=0|Use Source|1}-10Width 11.00 inch x Height 8.50 inchWidth: 11.00 inch, Height: 8.50 inch00::{Auto=1}11::{Auto=1}8.5Width 6600 x Height 5100-1-1-120RGB2150-1None11-11200.23999999999999999-11300-11-130024-bit Color0-1300RGB256 ColorsLZW-1300256 Colors-1-10000272-16410-100200-1300256 Colors-1Standard Options (ANSI)NormalDevice-1Standard Options (Text DXF)NormalInches-1300256 Colors-1600256 Colors0-1300256 Colors0-1300256 Colors0-11-100000100None372720 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-expGraph-ExportMEML.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings130Graph1 - ELPL_Lin - Copy::{Auto=1|Enable Substitution|0}<long name>C:\Users\JSB\Google Drive\Research\Communication\Manuscripts\M-EML Thickness\Figures3<Original>1::{Auto=0|Use Tools Options|1}-102506000::{Auto=0|Use Source|1}-10Width 10.72 inch x Height 8.21 inchWidth: 10.72 inch, Height: 8.21 inch00::{Auto=1}10.720000000000001::{Auto=1}8.2050000000000001Width 6432 x Height 4923-1-1-120RGB2150-1None11-11200.23999999999999999-11300-11-130024-bit Color0-1600RGB256 ColorsLZW-1300256 Colors-1-10000272-16410-100200-1300256 Colors-1Standard Options (ANSI)NormalDevice-1Standard Options (Text DXF)NormalInches-1300256 Colors-1600256 Colors0-1300256 Colors0-1300256 Colors0-11-100000100None372720 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-expGraph-ExportDossier.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings100Graph4 - M-EML Lifetime Summary - Copy::{Auto=1|Enable Substitution|0}<long name>C:\Users\JSB\Google Drive\Research\Communication\Dossier and Orals\Figures3<Original>1::{Auto=0|Use Tools Options|1}-102506000::{Auto=0|Use Source|1}-10Width 10.72 inch x Height 8.21 inchWidth: 10.72 inch, Height: 8.21 inch00::{Auto=1}10.720000000000001::{Auto=1}8.2050000000000001Width 6432 x Height 4923-1-1-120RGB2150-1None11-11200.23999999999999999-11300-11-130024-bit Color0-1600RGB256 ColorsLZW-1300256 Colors-1-10000272-16410-100200-1300256 Colors-1Standard Options (ANSI)NormalDevice-1Standard Options (Text DXF)NormalInches-1300256 Colors-1600256 Colors0-1300256 Colors0-1300256 Colors0-11-100000100None372720 3 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-FitLinear-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings2002200000111011001009511101100111100010001110010010000010001*equ*plot*w*inter*slope*rss*pr*cod*adj::{Auto=1||1}3010Name<auto>0<auto>tx170524<new>FitLinear100<none><auto>tx170524<new>FitLinearCurve1<fittedvalue>tx170524<fittedvalue>FitLinearCurve1<fittedvalue>tx170524<new>FitLinearFindXfromY1FitLinearFindYfromX1011111044372016104189163211101011310000::{Auto=1}-1.7781512503836425::{Auto=1}-0.99999999999999978000950501951950100100111001 3 | -------------------------------------------------------------------------------- /Documentation/origin_test.py: -------------------------------------------------------------------------------- 1 | # For documentation see: http://www.originlab.com/doc/COM/Classes 2 | # Wiki: http://wiki.originlab.com/~originla/wiki/index.php?title=Category:COM_Server 3 | # Some LabTalk commands don't seem to work on python, but I might be missing something 4 | # Labtalk documentation at: http://www.originlab.com/doc/LabTalk/ 5 | # Some crappy documentation on PyOrigin: http://www.originlab.com/doc/python 6 | import win32com.client 7 | import os 8 | # ------------------------------------ User inputs 9 | # Directory where templates are stored 10 | templateDir = os.path.abspath('C:\\Users\\JSB\\Documents\\OriginLab\\2016\\User Files\\') 11 | # ------------------------------------ 12 | # Connect to Origin 13 | origin = win32com.client.Dispatch("Origin.ApplicationSI") 14 | # To open a new origin session (not overlap on current open session use: 15 | # origin = win32com.client.Dispatch("Origin.Application") 16 | # Make session visible 17 | origin.Visible=1 18 | #origin.Exit() 19 | # Close previous project and make a new one 20 | origin.NewProject 21 | # Wait for origin to compile 22 | origin.Execute("sec -poc 3.5") 23 | # Preferred way to create a workbook is to use CreatePage and reference the 24 | # workbook by name. This just returns unicode of the name, and not an instance 25 | workbookName = origin.CreatePage(2, 'EL-PL' , 'Origin') # 2 for workbook 26 | # get workbook instance from name 27 | workbook = origin.WorksheetPages(workbookName) 28 | # Alternative command to make a workbook 29 | #workbook = origin.WorksheetPages.Add # For some reason this method results in odd formatting 30 | workbook.Name = 'TestName' 31 | # Get worksheet instance, index starts at 0 32 | worksheet = workbook.Layers(0) 33 | # Set number of columns 34 | worksheet.Cols = 5 35 | # Get column instance, index starts at 0 36 | column = worksheet.Columns(0) 37 | # Change column Units, Long Name, or Comments] 38 | column.LongName = 'This is a long name' 39 | column.Units = 'megameters' 40 | column.Comments = 'blah blah' 41 | # Set type to X 42 | column.Type = 3 43 | # Set type to Y 44 | column.Type = 0 45 | # Increase Width of Column: 46 | width = 10; 47 | col_idx = 0; 48 | origin.Execute('wks.col' + str(col_idx+1) + '.width=' + str(width) + ';') 49 | # Set user parameter rows, make visible, and rename 50 | # These header rows can be used to store reference information 51 | userParams = ['Voltage','Efficiency','t50'] 52 | for param_idx in range(0,len(userParams)): 53 | # Show the user-defined parameter (so row is visible when worksheet is opened) 54 | # Index starts at 1 55 | worksheet.Execute('wks.UserParam' + str(param_idx+1) + '=1;') 56 | # Set parameter name 57 | worksheet.Execute('wks.UserParam' + str(param_idx+1) + '$="' + userParams[param_idx] + '";') 58 | # set value in user param row 59 | value = 'my metadata' 60 | worksheet.Execute('col(' + str(col_idx+1) + ')[' + userParams[param_idx] + ']$ = "' + str(value) + '";') 61 | # Add another worksheet to the active page 62 | worksheet2 = origin.ActivePage.Layers.Add 63 | worksheet2.Name = 'Test2' 64 | # Make worksheet active (indexing starts at 0?) 65 | 66 | ##### This stuff might not work 67 | # origin.Execute('page.active$ = ' + str(0)) 68 | # Now that the worksheet is active, find it and get an instance 69 | worksheet = origin.FindWorksheet(workbookName) 70 | ##### 71 | 72 | # Save origin project 73 | savepath = 'C:\Users\JSB\Google Drive\Research\Scripts\Python\\' 74 | filename = 'test' 75 | # This isn't working for some reason 76 | #origin.Save(str(os.path.join(savepath,filename))) 77 | # Labtalk command can be used instead 78 | saveCommand = 'save ' + savepath + filename + '.opj' 79 | #origin.Execute(saveCommand) 80 | # Close origin, if desired 81 | #origin.Execute('doc -d;') 82 | #origin.Save(savepath + filename) 83 | # Put the X and Y data into the worksheet 84 | origin.PutWorksheet('['+workbook.Name+']'+worksheet.Name, xData, 0, 0) # row 0, col 0 85 | origin.PutWorksheet('['+workbook.Name+']'+worksheet.Name, yData, 0, 1) # row 0, col 1 86 | 87 | # Make the Origin session visible 88 | #origin.Execute('doc -mc 1;') 89 | 90 | # Clear "dirty" flag in Origin to suppress prompt 91 | # for saving current project 92 | #origin.IsModified('false') 93 | 94 | def createGraph(origin,graphName,templatePath,worksheets,x_cols,y_cols,LineOrSym): 95 | # origin is an origin app instance 96 | # graphName is a string of the name of the graph 97 | # templatePath is a string of the path and template name to be used 98 | # worksheets must be worksheet instance or a list of worksheet instances 99 | # Each worksheet must be formatted identically 100 | # For differently formatted worksheets, would need to make x_cols a list of lists 101 | # x_col, y_col, and LineOrSym should be same length 102 | # x_col and y_col are lists of indices for x and y columns that are paired element-wise 103 | # LineOrSym is a list of strings specifying 'Symbol', 'Line+Symbol', or 'Line' 104 | 105 | # Create graph page and instance 106 | # Standard template is 'Origin' 107 | graph = origin.CreatePage(3, graphName , templatePath); 108 | graph = origin.GraphPages(graph) 109 | # Find the graph layer 110 | graphLayer = origin.FindGraphLayer(graph) 111 | 112 | # Get dataplot collection from the graph layer 113 | dataPlots = graphLayer.DataPlots 114 | 115 | # Add data column by column to the graph 116 | # loop over worksheets within column loops so that data from same column 117 | # can be grouped. E.g. all PL data is in same column and will be grouped. 118 | for ci in range(0,len(x_cols)): 119 | for worksheet in worksheets: 120 | # Create a data range 121 | dr = origin.NewDataRange 122 | 123 | # Add data to data range 124 | # worksheet, start row, start col, end row (-1=last), end col 125 | dr.Add('X', worksheet, 0 , x_cols[ci], -1, x_cols[ci]) 126 | dr.Add('Y', worksheet, 0 , y_cols[ci], -1, y_cols[ci]) 127 | 128 | # Add data plot to graph layer 129 | # 200 -- line 130 | # 201 -- symbol 131 | # 202 -- symbol+line 132 | # If specified, plot symbol. By default, plot line 133 | if LineOrSym[ci] == 'Symbol': 134 | dataPlots.Add(dr, 201) 135 | elif LineOrSym[ci] == 'Line+Symbol': 136 | dataPlots.Add(dr, 202) 137 | else: 138 | dataPlots.Add(dr, 200) 139 | 140 | 141 | # Group each column (This allows colors to be automatically incremented 142 | # and a single legend entry to be created for all the data sets with 143 | # the same legend entry) 144 | BeginIndex = (ci-1)*len(worksheets) + 1 145 | EndIndex = BeginIndex + len(worksheets)-1 146 | graphLayer.Execute('layer -g ' + str(BeginIndex) + ' ' + str(EndIndex) + ';') 147 | 148 | 149 | # Rescales axes 150 | #Rescale type: 1 = manual, 2 = normal, 3 = auto, 4 = fixed from, and 5 = fixed to. 151 | #graphLayer.Execute(layer.axis.rescale=3'); 152 | graphLayer.Execute('Rescale') 153 | 154 | # For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 155 | # Reconstruct the legend (can be done manually in Origin via Ctrl+L) 156 | #graphLayer.Execute('legend -r;'); 157 | # For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 158 | 159 | 160 | -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/OriginPlotExample.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % This m-file shows some base operations between a MATLAB client and an 3 | % Origin Server application. 4 | % 5 | % This example does the following: 6 | % -> Connect to an existing Origin server application or create a new 7 | % one if none exists. 8 | % -> Create workbook and find workseet, and then change worksheet name. 9 | % -> Get columns from worksheet, and set column's type, and set data 10 | % to column. 11 | % -> Create graph and add x-y-error data as scatter line plot to graph. 12 | % -> Customize plot, such as axes' label, legend, range, etc. 13 | % -> Save project. 14 | % 15 | % Usage: 16 | % data = [0.1:0.1:3; sin(0.1:0.1:3)]'; 17 | % OriginPlotExample(data, {'x data','sin(x)'}, 'testPlot.opj', 'C:\Users\...\'); 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | 20 | % Documentation resources: 21 | % Automation server forum: http://www.originlab.com/forum/forum.asp?FORUM_ID=18 22 | % Lab talk documentation: http://www.originlab.com/doc/LabTalk/ 23 | % In origin: Help -> Programming -> Automation Server 24 | 25 | 26 | function OriginPlotExample(data, legendEntries, opjFilename, path) 27 | 28 | %% Initiate session and project 29 | % longNames must be a cell array of strings, corresponding to each 30 | % column of EQE data 31 | 32 | % Obtain Origin COM Server object 33 | % Connect to an existing instance of Origin 34 | % or create a new one if none exists 35 | originObj = actxserver('Origin.ApplicationSI'); 36 | 37 | % Close previous project and make a new one 38 | invoke(originObj, 'NewProject'); 39 | 40 | % Make the Origin session visible (I don't know why this is necessary) 41 | invoke(originObj, 'Execute', 'doc -mc 1;'); 42 | 43 | % Clear "dirty" flag in Origin to suppress prompt 44 | % for saving current project 45 | invoke(originObj, 'IsModified', 'false'); 46 | 47 | % Create a workbook 48 | % 2 -> workbook, 3 -> graph, more documentation at: http://www.originlab.com/doc/COM/Classes/Application/CreatePage 49 | % Type of Page, Workbook name , Template 50 | workbook = invoke(originObj, 'CreatePage', 2 , 'My Workbook name', 'Origin'); 51 | 52 | % Find the worksheet 53 | worksheet = invoke(originObj, 'FindWorksheet', workbook); 54 | 55 | % Rename the worksheet 56 | invoke(worksheet, 'Name', 'My Worksheet Name'); 57 | 58 | %% Insert data into worksheet 59 | % Set number of columns based on data 60 | NumberOfColumns = size(data,2); 61 | invoke(worksheet, 'Cols', NumberOfColumns); 62 | 63 | % Get column collection in the worksheet 64 | cols = invoke(worksheet, 'Columns'); 65 | 66 | % NOTE: column indexing in origin starts from 0 67 | 68 | % Column # (starting from 0) 69 | colx = invoke(cols, 'Item', uint8(0)); % I don't know why they use the uint8() command. Should work either way. 70 | coly = invoke(cols, 'Item', uint8(1)); 71 | 72 | % Write long name, units, and comments: 73 | coly.invoke('LongName', 'Date, Sample, etc.'); % Here I mix syntax. Both invoke(coly,...) and coly.invoke(...) work. 74 | coly.invoke('Units', 'mA/cm^2'); 75 | coly.invoke('Comments', legendEntries{i}); 76 | 77 | % Set column type 78 | % 3 -> x, 0 -> y, 2 -> error 79 | invoke(colx, 'Type', 3); % x column 80 | invoke(coly, 'Type', 0); % y column 81 | 82 | 83 | % Insert data into the columns 84 | % starting col, starting row 85 | invoke(worksheet, 'SetData', num2cell(data), 0 , 0); 86 | % Note: Origin interprets cell arrays better than doubles for some 87 | % reason. For example, they will truncate NaN's, whereas if passing a 88 | % double array with NaN's, Origin will freak out and add seemingly 89 | % random points. The num2cell() conversion is not required, however. 90 | 91 | %% Create a graph 92 | 93 | % Set template file path 94 | templatePath = 'C:\Users\username\Documents\OriginLab\2016\User Files\myTemplate.otp'; 95 | % Make graph object 96 | graphObject = invoke(originObj, 'CreatePage', 3, 'My Graph Name', templatePath); 97 | % Note: replace template path with 'Origin' if you do not wish to apply 98 | % a template 99 | 100 | % Find the graph layer 101 | graphLayer = invoke(originObj, 'FindGraphLayer', graphObject); 102 | 103 | % Get dataplot collection from the graph layer 104 | dataPlots = invoke(graphLayer, 'DataPlots'); 105 | 106 | % Create a data range 107 | dataRange = invoke(originObj, 'NewDataRange'); 108 | 109 | % Add data to data range 110 | % Start Row? Start Col Index End Row?? End Col Index 111 | invoke(dataRange, 'Add', 'X', worksheet, 0 , 0 , -1 , 0 ); 112 | invoke(dataRange, 'Add', 'Y', worksheet, 0 , 1 , -1 , 1 ); 113 | % I don't really understand what the third index does, but -1 has 114 | % worked for me. 115 | % You may be able to add multiple Y columns at once by changing the End 116 | % Col index, but I haven't tested thi. 117 | 118 | % Add data plot to graph layer 119 | % 200 -- line 120 | % 201 -- symbol 121 | % 202 -- symbol+line 122 | invoke(dataPlots, 'Add', dataRange, 200); % 200 for line plot 123 | 124 | % If you want to add multiple columns of data in a loop, you need to 125 | % call each of these commands in each loop: 126 | % dataRange = invoke(originObj, 'NewDataRange'); 127 | % invoke(dr, 'Add', 'X', worksheet, 0 , x_column_index , -1, x_column_index ); 128 | % invoke(dr, 'Add', 'Y', worksheet, 0 , y_column_index , -1, y_column_index ); 129 | % invoke(dataPlots, 'Add', dataRange, 202); % 202 for symbol+line plot 130 | 131 | 132 | 133 | 134 | %% Commands to rescale the graph and set axes labels (unnecessary with template) 135 | % % Auto-Rescale the graph layer 136 | % invoke(gl, 'Execute', 'rescale;'); 137 | % 138 | % % Change the bottom x' title 139 | % invoke(gl, 'Execute', 'xb.text$ = "J (mA/cm^2)";'); 140 | % % Change the left y's title 141 | % invoke(gl, 'Execute', 'yl.text$ = "EQE (%)";'); 142 | % 143 | % %show the top and right axes 144 | % invoke(gl, 'Execute', 'range ll = !;'); 145 | % invoke(gl, 'Execute', 'll.x2.showAxes=3;'); 146 | % invoke(gl, 'Execute', 'll.y2.showAxes=3;'); 147 | % 148 | % %set the x axis scale 149 | % invoke(gl, 'Execute', 'll.x.from=1E-4;'); 150 | % invoke(gl, 'Execute', 'll.x.to=1E3;'); 151 | % 152 | % %set the y axis scale 153 | % invoke(gl, 'Execute', 'll.y.from=-2.5;'); 154 | % invoke(gl, 'Execute', 'll.y.to=22.5;'); 155 | % 156 | % %set the x axis Major tick increment. 157 | % invoke(gl, 'Execute', 'll.x.inc=10;'); 158 | 159 | %% Group data and handle the legend 160 | % Group data (This allows colors to be automatically incremented and a 161 | % single legend entry to be created for all the data sets with the 162 | % same legend entry) 163 | invoke(graphLayer, 'Execute', 'layer -g;'); 164 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 165 | 166 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 167 | invoke(graphLayer, 'Execute', 'legend -r;'); 168 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 169 | 170 | %% Save the .opj file and close out origin 171 | %Save the current project to a .opj using the specified path and filename 172 | saveCommand = ['save ' path opjFilename '.opj']; 173 | invoke(originObj, 'Execute', saveCommand); 174 | % saveCommand should have form 'save C:\myPath\myOriginFile.opj' 175 | 176 | % Close the project (this will allow you to delete or modify the 177 | % project. Otherwise the project will stay open.) 178 | invoke(originObj, 'Execute', 'doc -d;') 179 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Document-cmd 180 | 181 | 182 | % Release 183 | release(originObj); -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/tester2.m: -------------------------------------------------------------------------------- 1 | function createGraph(graphName,templatePath,x_cols,y_cols,LineOrSym,wksObj) 2 | % Create graph page and object 3 | graphObj = invoke(originObj, 'CreatePage', 3, graphName , templatePath); 4 | 5 | % Find the graph layer 6 | graphLayer = invoke(originObj, 'FindGraphLayer', graphObj); 7 | 8 | % Get dataplot collection from the graph layer 9 | dataPlots = invoke(graphLayer, 'DataPlots'); 10 | 11 | % Add data column by column to the graph 12 | for ci = 1 : length(x_cols) 13 | % Create a data range 14 | dr = invoke(originObj, 'NewDataRange'); 15 | 16 | % Add data to data range 17 | % worksheet, start row, start col, end row (-1=last), end col 18 | dr.invoke('Add', 'X', wksObj, 0 , x_cols(ci), -1, x_cols(ci)); 19 | dr.invoke('Add', 'Y', wksObj, 0 , y_cols(ci), -1, y_cols(ci)); 20 | 21 | % Add data plot to graph layer 22 | % 200 -- line 23 | % 201 -- symbol 24 | % 202 -- symbol+line 25 | % If specified, plot symbol. By default, plot line 26 | if any(strcmp(LineOrSym,{'Sym','Symbol','Symbols'})) 27 | dataPlots.invoke('Add', dr, 201); 28 | else 29 | dataPlots.invoke('Add', dr, 200); 30 | end 31 | end 32 | 33 | % Group data (This allows colors to be automatically incremented and a 34 | % single legend entry to be created for all the data sets with the 35 | % same legend entry) 36 | invoke(graphLayer, 'Execute', 'layer -g;'); 37 | 38 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 39 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 40 | %invoke(graphLayer, 'Execute', 'legend -r;'); 41 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 42 | 43 | end 44 | 45 | function createGraph_multiwks(graphName,templatePath,x_cols,y_cols,LineOrSym,wksObj) 46 | % wksObj must be a cell array of worksheet Objects 47 | % Each worksheet must be formatted identically 48 | % Create graph page and object 49 | graphObj = invoke(originObj, 'CreatePage', 3, graphName , templatePath); 50 | 51 | % Find the graph layer 52 | graphLayer = invoke(originObj, 'FindGraphLayer', graphObj); 53 | 54 | % Get dataplot collection from the graph layer 55 | dataPlots = invoke(graphLayer, 'DataPlots'); 56 | 57 | % Add data column by column to the graph 58 | for wi = 1 : length(wksObj) 59 | for ci = 1 : length(x_cols) 60 | % Create a data range 61 | dr = invoke(originObj, 'NewDataRange'); 62 | 63 | % Add data to data range 64 | % worksheet, start row, start col, end row (-1=last), end col 65 | dr.invoke('Add', 'X', wksObj{wi}, 0 , x_cols(ci), -1, x_cols(ci)); 66 | dr.invoke('Add', 'Y', wksObj{wi}, 0 , y_cols(ci), -1, y_cols(ci)); 67 | 68 | % Add data plot to graph layer 69 | % 200 -- line 70 | % 201 -- symbol 71 | % 202 -- symbol+line 72 | % If specified, plot symbol. By default, plot line 73 | if any(strcmp(LineOrSym,{'Sym','Symbol','Symbols'})) 74 | dataPlots.invoke('Add', dr, 201); 75 | else 76 | dataPlots.invoke('Add', dr, 200); 77 | end 78 | end 79 | end 80 | 81 | % Group data (This allows colors to be automatically incremented and a 82 | % single legend entry to be created for all the data sets with the 83 | % same legend entry) 84 | invoke(graphLayer, 'Execute', 'layer -g;'); 85 | 86 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 87 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 88 | %invoke(graphLayer, 'Execute', 'legend -r;'); 89 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 90 | 91 | end 92 | 93 | function []=hello() 94 | 95 | graphNames = {'ELPL-Lin','ELPL-Log','V-Lin','dV-Lin','PL-CB-vs-ELRatio'}; % 'tx-vs-L0' 96 | templateNames = {'LT-ELPL-Lin.otp','LT-ELPL-Log.otp','LT-V-Lin.otp','LT-dV-Lin-Sym.otp','PL_CB_vs_ELRatio.otp'}; 97 | templateDir = 'C:\Users\JSB\Documents\OriginLab\2016\User Files\'; 98 | templateFullPath = [templateDir templateNames{gi}]; 99 | % Alternative templates: 100 | % 'LT-dV-Lin-Line.otp' 101 | 102 | for gi = 1 : length(graphNames); 103 | 104 | end 105 | 106 | %% 107 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 108 | 109 | % Create Driving Voltage vs. hours graph 110 | templatePath = 'C:\Users\JSB\Documents\OriginLab\2016\User Files\Lifetime-V-Line.otp'; 111 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Graph Name 112 | graph_V = invoke(originObj, 'CreatePage', 3, 'Driving Voltage' , templatePath); 113 | 114 | % Find the graph layer 115 | graphLayer_V = invoke(originObj, 'FindGraphLayer', graph_V); 116 | 117 | % Get dataplot collection from the graph layer 118 | dataplots_Lum = invoke(graphLayer_V, 'DataPlots'); 119 | 120 | % Add data column by column to the graph 121 | for i = 1 : size(lifetimeArray,2)/3 122 | hrs_col_idx = 3*i - 3; 123 | V_col_idx = 3*i - 2; 124 | 125 | % Create a data range 126 | dr = invoke(originObj, 'NewDataRange'); 127 | 128 | % Add data to data range 129 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 130 | invoke(dr, 'Add', 'X', wkSheet_lifetime, 0 , hrs_col_idx, -1, hrs_col_idx); % x is hrs 131 | invoke(dr, 'Add', 'Y', wkSheet_lifetime, 0 , V_col_idx, -1, V_col_idx); % y is V 132 | 133 | % Add data plot to graph layer 134 | % 200 -- line 135 | % 201 -- symbol 136 | % 202 -- symbol+line 137 | invoke(dataplots_Lum, 'Add', dr, 200); 138 | end 139 | 140 | % Group data (This allows colors to be automatically incremented and a 141 | % single legend entry to be created for all the data sets with the 142 | % same legend entry) 143 | invoke(graphLayer_V, 'Execute', 'layer -g;'); 144 | 145 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 146 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 147 | invoke(graphLayer_V, 'Execute', 'legend -r;'); 148 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 149 | %% 150 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 151 | 152 | % Create Double Y L/L0 and V vs hrs graph 153 | templatePath = 'C:\Users\JSB\Documents\OriginLab\2016\User Files\LifetimeYY-Lum-V-Line.otp'; 154 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Graph Name 155 | graph_V_Lum = invoke(originObj, 'CreatePage', 3, 'Luminance-Voltage' , templatePath); 156 | 157 | 158 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 159 | 160 | % First the L/L0 layer (Layer 1) 161 | invoke(originObj, 'Execute', 'layer -s 1;'); 162 | % Find the layer 163 | graphLayer_Lum = invoke(originObj, 'FindGraphLayer', graph_V_Lum); 164 | % Make Layer 1 active 165 | 166 | % Get dataplot collection from the graph layer 167 | dataplots_Lum = invoke(graphLayer_Lum, 'DataPlots'); 168 | 169 | % Add data column by column to the graph 170 | for i = 1 : size(lifetimeArray,2)/3 171 | hrs_col_idx = 3*i - 3; 172 | lum_col_idx = 3*i - 1; 173 | % Create a data range 174 | dr = invoke(originObj, 'NewDataRange'); 175 | 176 | % Add data to data range 177 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 178 | invoke(dr, 'Add', 'X', wkSheet_lifetime, 0 , hrs_col_idx, -1, hrs_col_idx); % x is hrs 179 | invoke(dr, 'Add', 'Y', wkSheet_lifetime, 0 , lum_col_idx, -1, lum_col_idx); % y is L/L0 180 | 181 | % Add data plot to graph layer 182 | % 200 -- line 183 | % 201 -- symbol 184 | % 202 -- symbol+line 185 | invoke(dataplots_Lum, 'Add', dr, 200); 186 | end 187 | 188 | % Group data (This allows colors to be automatically incremented and a 189 | % single legend entry to be created for all the data sets with the 190 | % same legend entry) 191 | invoke(graphLayer_Lum, 'Execute', 'layer -g;'); 192 | 193 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 194 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 195 | invoke(graphLayer_Lum, 'Execute', 'legend -r;'); 196 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 197 | 198 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 199 | % Now driving voltage layer 200 | % Make Layer 2 active 201 | invoke(originObj, 'Execute', 'layer -s 2;'); 202 | % Now find the layer 203 | graphLayer_V = invoke(originObj, 'FindGraphLayer', graph_V_Lum); 204 | % Get dataplot collection from the graph layer 205 | dataplots_V = invoke(graphLayer_V, 'DataPlots'); 206 | 207 | % Add data column by column to the graph 208 | for i = 1 : size(lifetimeArray,2)/3 209 | hrs_col_idx = 3*i - 3; 210 | V_col_idx = 3*i - 2; 211 | 212 | % Create a data range 213 | dr = invoke(originObj, 'NewDataRange'); 214 | 215 | % Add data to data range 216 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 217 | invoke(dr, 'Add', 'X', wkSheet_lifetime, 0 , hrs_col_idx, -1, hrs_col_idx); % x is hrs 218 | invoke(dr, 'Add', 'Y', wkSheet_lifetime, 0 , V_col_idx, -1, V_col_idx); % y is V 219 | 220 | % Add data plot to graph layer 221 | % 200 -- line 222 | % 201 -- symbol 223 | % 202 -- symbol+line 224 | invoke(dataplots_V, 'Add', dr, 200); 225 | end 226 | 227 | % Group data (This allows colors to be automatically incremented and a 228 | % single legend entry to be created for all the data sets with the 229 | % same legend entry) 230 | invoke(graphLayer_V, 'Execute', 'layer -g;'); 231 | 232 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Layer-cmd 233 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 234 | %invoke(graphLayer_JV, 'Execute', 'legend -r;'); 235 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Legend-cmd 236 | 237 | end -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-Fitexp-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings20-1100000100000010ExponentialExpDec100053205080.20000000000000001800.523104001.0000000000000001E-90.00500000000000000014.9999999999999997E-304.9999999999999998E3000101y = A1*exp(-x/t1) + y00100100951110001110111100010001110010110000010001*model*equ*plot*pm*rcs*cod*adj::{Auto=1||1}1010Name<auto>0<auto>Book1<new>FitExp100<none><auto>Book1<new>FitExpCurve1<fittedvalue>Book1<fittedvalue>FitExpCurve1<fittedvalue>Book1<new>FitExpFindXfromY1FitExpFindYfromX10110098069856099454241611101011010000::{Auto=1}3.29600004E-7::{Auto=1}1.66480002E-6031000::{Auto=1}0.027774915048819234::{Auto=1}0.76607174903613262001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}000950100100111001110000000-0.0264488359556529011.53656785526346214.9781897996711972E-7-1.23456789e-30000000000-1.23456789e-300-1.23456789e-300-1.23456789e-300000000-0.0264488359556529011.53656785526346214.9781897996711972E-7000 9 | -------------------------------------------------------------------------------- /OriginTemplates/Themes/AnalysisAndReportTable/0-Fitpeak-Last used.ois: -------------------------------------------------------------------------------- 1 | 2 | Settings20-1100000100000010Peak FunctionsGaussian00053205080.20000000000000001800.523104001.0000000000000001E-90.00500000000000000014.9999999999999997E-304.9999999999999998E3000101y = y0 + A/(w*sqrt(PI/(4*ln(2)))) * exp(-4*ln(2)*(x-xc)^2/w^2)0100100951110001110111100010001110010110000010001*model*equ*plot*pm*rcs*cod*adj::{Auto=1||1}1010Name<auto>0<auto>Book1<new>Fitpeak100<none><auto>Book1<new>FitpeakCurve1<fittedvalue>Book1<fittedvalue>FitpeakCurve1<fittedvalue>Book1<new>FitpeakFindXfromY1FitpeakFindYfromX10110047776072047725083211101011010000::{Auto=1}-2::{Auto=1}2001000::{Auto=1}0.049000000000000002::{Auto=1}0.40200000000000002001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}001000::{Auto=1}::{Auto=1}000950100100111001110000000000.12100.40421.1477173571380095-1.23456789e-300-1.23456789e-300-1.23456789e-300000010001-1.23456789e-300-1.23456789e-300-1.23456789e-300-1.23456789e-300000000000.12100.40421.14771735713800950000 4 | -------------------------------------------------------------------------------- /Documentation/MATLAB_Documentation/OriginPlotXY.m: -------------------------------------------------------------------------------- 1 | function OriginPlotXY(templatePath, savePath, opj_filename, new_or_existing, symbol_or_line, legendEntries, metadataHeader, x_units, y_units, x, y, y_error) 2 | %% Documentation 3 | % This function allows one to send x, y, and y-error data to an origin 4 | % project (either new or existing) and apply a user-defined template. 5 | % 6 | % y-error is an optional input 7 | % x and y must be of equal dimension, or x must have only one column 8 | % metadataHeader should be of equal column number as y 9 | % legendEntries must be a cell array of strings, corresponding to each 10 | % column of y data 11 | % symbol_or_line -> 'symbol', 'line', or 'symbol+line' are acceptable 12 | % inputs 13 | % new_or_existing -> 'New' or 'Existing' are acceptable inputs 14 | % Example usage: 15 | % templatePath = 'C:\Users\JSB\Documents\OriginLab\2016\User Files\EQE-Line.otp'; 16 | % OriginPlotXY(templatePath, savePath, opj_filename, 'New', 'line', legendEntries, metadataHeader, x_units, y_units, x, y, y_error) 17 | 18 | numberOfInputs = 12; 19 | %% Initiate Origin Session and Project 20 | % Obtain Origin COM Server object 21 | % Connect to an existing instance of Origin 22 | % or create a new one if none exists 23 | originObj = actxserver('Origin.ApplicationSI'); 24 | 25 | % Open project or make new project 26 | if strcmp(new_or_existing,'New') 27 | % Close previous project and make a new one 28 | invoke(originObj, 'NewProject'); 29 | elseif strcmp(new_or_existing,'Existing') 30 | openCommand = ['doc -o ' savePath opj_filename '.opj;']; % terminate savePath with \ 31 | invoke(originObj, 'Execute', openCommand); 32 | else 33 | error('Acceptable inputs are ''New'' or ''Existing'' for new_or_existing') 34 | end 35 | 36 | % Make the Origin session visible 37 | invoke(originObj, 'Execute', 'doc -mc 1;'); 38 | 39 | % Clear "dirty" flag in Origin to suppress prompt 40 | % for saving current project 41 | invoke(originObj, 'IsModified', 'false'); 42 | 43 | 44 | 45 | %% Send data to workbook 46 | % Create a workbook 47 | wkBook = invoke(originObj, 'CreatePage', 2);%, 'EQE' , 'Origin'); 48 | % Find the worksheet 49 | wkSheet = invoke(originObj, 'FindWorksheet', wkBook); 50 | 51 | % Set number of columns based on inputs and array sizes 52 | % Make data array of alternating x, y, y-error columns 53 | if size(x,2) == 1 && nargin < numberOfInputs 54 | NumOfColumns = size(x,2) + size(y,2); 55 | dataArray = [x, y]; 56 | elseif size(x,2) == 1 && nargin == numberOfInputs 57 | NumOfColumns = size(x,2) + size(y,2) + size(y_error,2); 58 | dataArray = x; 59 | % Make array of alternating y and y-error columns 60 | for i = 1 : size(y,2) 61 | dataArray = [dataArray, y(:,i), y_error(:,i)]; 62 | end 63 | elseif size(x,2) > 1 && nargin < numberOfInputs 64 | NumOfColumns = size(x,2) + size(y,2); 65 | dataArray = []; 66 | % Make array of alternating y and y-error columns 67 | for i = 1 : size(y,2) 68 | dataArray = [dataArray, x(:,i), y(:,i)]; 69 | end 70 | elseif size(x,2) > 1 && nargin == numberOfInputs 71 | NumOfColumns = size(x,2) + size(y,2) + size(y_error,2); 72 | dataArray = []; 73 | % Make array of alternating y and y-error columns 74 | for i = 1 : size(y,2) 75 | dataArray = [dataArray, x(:,i), y(:,i), y_error(:,i)]; 76 | end 77 | end; 78 | 79 | invoke(wkSheet, 'Cols', NumOfColumns); 80 | 81 | % Get column collection in the worksheet 82 | columns = invoke(wkSheet, 'Columns'); 83 | 84 | % Get user param titles from first column of metadataHeader 85 | userParams = metadataHeader(:,1); 86 | % Now make user param rows visible and rename 87 | for param_idx = 1 : length(userParams) 88 | % Show the user-defined parameter (so row is visible when worksheet is opened) 89 | invoke(wkSheet, 'Execute', ['wks.UserParam' num2str(param_idx) '=1;']); 90 | % Set parameter name 91 | invoke(wkSheet, 'Execute', ['wks.UserParam' num2str(param_idx) '$="' userParams{param_idx} '";']); 92 | end 93 | 94 | % Set x column (if only one x column) 95 | if size(x,2) == 1 96 | col_x = invoke(columns, 'Item', uint8(0)); 97 | col_x.invoke('Units',x_units{1}); 98 | col_x.invoke('Type',3); % 3 -> x column 99 | end 100 | 101 | for i = 1 : size(y,2); 102 | if size(x,2) == 1 && nargin < numberOfInputs 103 | col_y_index = i; 104 | % get column objects for y and y error 105 | col_y = invoke(columns, 'Item', uint8(col_y_index)); 106 | % Set column types (e.g. y or error) 107 | col_y.invoke('Type',0); % 2 -> y error column 108 | % Set units 109 | col_y.invoke('Units', y_units{i}); 110 | elseif size(x,2) > 1 && nargin < numberOfInputs % If >1 x column and no error 111 | col_y_index = 2*i - 1; 112 | col_x = invoke(columns, 'Item', uint8(col_y_index - 1)); 113 | col_y = invoke(columns, 'Item', uint8(col_y_index)); 114 | % Set column types (e.g. y or error) 115 | col_x.invoke('Type',3); % 3 -> x column 116 | col_y.invoke('Type',0); % 2 -> y error column 117 | % Set units 118 | col_x.invoke('Units', x_units{i}); 119 | col_y.invoke('Units', y_units{i}); 120 | elseif size(x,2) == 1 && nargin == numberOfInputs % If one x column + y error 121 | col_y_index = 2*i - 1; 122 | % get column objects for y and y error 123 | col_y = invoke(columns, 'Item', uint8(col_y_index)); 124 | col_error = invoke(columns, 'Item', uint8(col_y_index+1)); 125 | % Set column types (e.g. y or error) 126 | col_y.invoke('Type',0); % 0 -> y column 127 | col_error.invoke('Type',2); % 2 -> y error column 128 | % Set units 129 | col_y.invoke('Units', y_units{i}); 130 | col_error.invoke('Units', y_units{i}); 131 | elseif size(x,2) > 1 && nargin == numberOfInputs % If one x column + y error 132 | col_y_index = 3*i - 2; 133 | % get column objects for y and y error 134 | col_x = invoke(columns, 'Item', uint8(col_y_index - 1)); 135 | col_y = invoke(columns, 'Item', uint8(col_y_index)); 136 | col_error = invoke(columns, 'Item', uint8(col_y_index + 1)); 137 | % Set column types (e.g. y or error) 138 | col_x.invoke('Type',3); % 3 -> x column 139 | col_y.invoke('Type',0); % 0 -> y column 140 | col_error.invoke('Type',2); % 2 -> y error column 141 | % Set units 142 | col_x.invoke('Units', x_units{i}); 143 | col_y.invoke('Units', y_units{i}); 144 | col_error.invoke('Units', y_units{i}); 145 | end 146 | 147 | % Enter metadata into user-defined parameter rows: 148 | for param_idx = 1 : length(userParams) 149 | % syntax: 'col(ColumnIndex)[UserParameterRowName]$ = "UserParameterMetadata";' 150 | % e.g.: 'col(1)[Date]$ = "2016-01-05";' 151 | % Note: who knows what origin developers were thinking, but in 152 | % this case, column indexing starts from 1, not 0. Consistency 153 | % nightmare. The +1 accounts for this 154 | % Metadata is placed in same column as y data 155 | invoke(wkSheet,'Execute',['col(' num2str(col_y_index+1) ')[' ... 156 | userParams{param_idx} ']$ = "' metadataHeader{param_idx,i+1} '";']); 157 | end 158 | 159 | % Add comments text, which is accessed by the legend and determines 160 | % color incrementing/grouping of data 161 | col_y.invoke('Comments', legendEntries{i}); 162 | 163 | end 164 | %% Send data to graph 165 | % Set data to the columns 166 | % I use num2cell because origin can interpret NaN values in a cell 167 | % array but not in a double array for some reason. 168 | invoke(wkSheet, 'SetData', num2cell(dataArray), 0, 0); 169 | 170 | % Create a graph 171 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Graph Name 172 | graph = invoke(originObj, 'CreatePage', 3, 'Graph1', templatePath); 173 | 174 | % Find the graph layer 175 | graphLayer = invoke(originObj, 'FindGraphLayer', graph); 176 | 177 | % Get dataplot collection from the graph layer 178 | dataplots = invoke(graphLayer, 'DataPlots'); 179 | 180 | % Add data column by column to the graph 181 | for i = 1 : size(y,2) 182 | % Create a data range 183 | dr = invoke(originObj, 'NewDataRange'); 184 | 185 | if size(x,2) == 1 && nargin < numberOfInputs 186 | col_y_index = i; 187 | % Add data to data range 188 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 189 | invoke(dr, 'Add', 'X', wkSheet, 0 , 0 , -1, 0 ); 190 | invoke(dr, 'Add', 'Y', wkSheet, 0 , col_y_index , -1, col_y_index ); 191 | elseif size(x,2) > 1 && nargin < numberOfInputs % If >1 x column and no error 192 | col_y_index = 2*i - 1; 193 | col_x_index = col_y_index - 1; 194 | % Add data to data range 195 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 196 | invoke(dr, 'Add', 'X', wkSheet, 0 , col_x_index , -1, col_x_index ); 197 | invoke(dr, 'Add', 'Y', wkSheet, 0 , col_y_index , -1, col_y_index ); 198 | elseif size(x,2) == 1 && nargin == numberOfInputs % If one x column + y error 199 | col_y_index = 2*i - 1; 200 | col_error_index = col_y_index + 1; 201 | % Add data to data range 202 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 203 | invoke(dr, 'Add', 'X', wkSheet, 0 , 0 , -1, 0 ); 204 | invoke(dr, 'Add', 'Y', wkSheet, 0 , col_y_index , -1, col_y_index ); 205 | invoke(dr, 'Add', 'ED', wkSheet, 0 , col_error_index , -1, col_error_index ); 206 | elseif size(x,2) > 1 && nargin == numberOfInputs % If one x column + y error 207 | col_y_index = 3*i - 2; 208 | col_x_index = col_y_index - 1; 209 | col_error_index = col_y_index + 1; 210 | % Add data to data range 211 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% row col row col 212 | invoke(dr, 'Add', 'X', wkSheet, 0 , col_x_index , -1, col_x_index ); 213 | invoke(dr, 'Add', 'Y', wkSheet, 0 , col_y_index , -1, col_y_index ); 214 | invoke(dr, 'Add', 'ED', wkSheet, 0 , col_error_index , -1, col_error_index ); 215 | end 216 | 217 | % Add data plot to graph layer 218 | % 200 -- line 219 | % 201 -- symbol 220 | % 202 -- symbol+line 221 | if strcmp(symbol_or_line,'symbol') 222 | invoke(dataplots, 'Add', dr, 201); 223 | elseif strcmp(symbol_or_line,'line') 224 | invoke(dataplots, 'Add', dr, 200); 225 | elseif strcmp(symbol_or_line,'symbol+line') 226 | invoke(dataplots, 'Add', dr, 202); 227 | end 228 | end 229 | 230 | % Group data (This allows colors to be automatically incremented and a 231 | % single legend entry to be created for all the data sets with the same 232 | % legend entry) 233 | invoke(graphLayer, 'Execute', 'layer -g;'); 234 | 235 | % Reconstruct the legend (can be done manually in Origin via Ctrl+L) 236 | invoke(graphLayer, 'Execute', 'legend -r;'); 237 | 238 | %% Commands to rescale the graph and set axes labels (unnecessary with template) 239 | % % Auto-Rescale the graph layer 240 | % invoke(gl, 'Execute', 'rescale;'); 241 | % 242 | % % Change the bottom x' title 243 | % invoke(gl, 'Execute', 'xb.text$ = "J (mA/cm^2)";'); 244 | % % Change the left y's title 245 | % invoke(gl, 'Execute', 'yl.text$ = "EQE (%)";'); 246 | % 247 | % %show the top and right axes 248 | % invoke(gl, 'Execute', 'range ll = !;'); 249 | % invoke(gl, 'Execute', 'll.x2.showAxes=3;'); 250 | % invoke(gl, 'Execute', 'll.y2.showAxes=3;'); 251 | % 252 | % %set the x axis scale 253 | % invoke(gl, 'Execute', 'll.x.from=1E-4;'); 254 | % invoke(gl, 'Execute', 'll.x.to=1E3;'); 255 | % 256 | % %set the y axis scale 257 | % invoke(gl, 'Execute', 'll.y.from=-2.5;'); 258 | % invoke(gl, 'Execute', 'll.y.to=22.5;'); 259 | % 260 | % %set the x axis Major tick increment. 261 | % invoke(gl, 'Execute', 'll.x.inc=10;'); 262 | 263 | %% Save and exit 264 | %Save the current project using the specified path and filename 265 | if strcmp(new_or_existing,'New') 266 | saveCommand = ['save ' savePath opj_filename '.opj;']; 267 | invoke(originObj, 'Execute', saveCommand); 268 | elseif strcmp(new_or_existing,'Existing') 269 | saveCommand = ['save ' savePath opj_filename '.opj;']; % May need to append $ at end of filename?? 270 | invoke(originObj, 'Execute', saveCommand); 271 | end 272 | % saveCommand should have form 'save C:\myPath\myOriginFile.opj' 273 | 274 | % Close the project (this will allow you to delete or modify the 275 | % project. Otherwise the project will stay open.) 276 | invoke(originObj, 'Execute', 'doc -d;'); 277 | % For further documentation see: http://www.originlab.com/doc/LabTalk/ref/Document-cmd 278 | 279 | % Release 280 | release(originObj); 281 | -------------------------------------------------------------------------------- /py2origin.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import time 3 | import numpy as np 4 | import win32com.client 5 | import os 6 | import matplotlib.pyplot as plt 7 | import matplotlib.colors as colors 8 | import OriginExt 9 | 10 | ''' 11 | Useful documentation sources: 12 | https://www.originlab.com/doc/COM/Classes/ApplicationSI 13 | Description of classes and functions available through COM server 14 | https://www.originlab.com/doc/OriginC/ref/ 15 | Some overlap with above, but at times provides more specific examples 16 | This lists a number of the commands for OriginC 17 | These can often be directly translated to python commands 18 | https://www.originlab.com/doc/LabTalk/ref/ 19 | LabTalk commands often allow more specific/particular operations 20 | e.g. changing axis scales, font sizes, etc. 21 | ''' 22 | 23 | # Ideas for improvements: 24 | # - Compile line data (labels, format, color) into df 25 | # then use df to sort and group lines in origin 26 | # - support for subplots / multiple layers 27 | # - support for double y or double x axes 28 | # - support for errorbars 29 | def set_axis_scale(graph_layer,axis='x',scale='linear'): 30 | # axis = 'x' or 'y' 31 | # scale = 'linear' or 'log' 32 | # graph_layer is origin graph_layer object 33 | # Axis label number format: 34 | # 1 = decimal without commas, 2 = scientific, 35 | # 3 = engineering, and 4 = decimal with commas (for date). 36 | # https://www.originlab.com/doc/LabTalk/ref/Layer-Axis-Label-obj 37 | if scale=='linear': 38 | graph_layer.Execute('layer.'+axis+'.type = 0;') 39 | # Change number format to decimal 40 | graph_layer.Execute('layer.'+axis+'.label.numFormat=1') 41 | elif scale=='log': 42 | graph_layer.Execute('layer.'+axis+'.type = 2;') 43 | # Change tick label number type to scientific 44 | graph_layer.Execute('layer.'+axis+'.label.numFormat=2') 45 | return 46 | def get_graphpages(origin): 47 | graphpages = [] 48 | graphnames = [] 49 | for gp in origin.GraphPages: 50 | graphpages.append(gp) 51 | graphnames.append(gp.Name) 52 | return graphpages,graphnames 53 | def get_workbooks(origin): 54 | workbooks = [] 55 | workbook_names = [] 56 | for wb in origin.WorksheetPages: 57 | workbooks.append(wb) 58 | workbook_names.append(wb.Name) 59 | return workbooks,workbook_names 60 | def get_all_sheets(origin): 61 | worksheets=[] 62 | worksheet_names=[] 63 | for wb in origin.WorksheetPages: 64 | for ws in wb.Layers: 65 | worksheets.append(ws) 66 | worksheet_names.append(ws.Name) 67 | print('Found ' + str(len(worksheets)) + ' worksheets') 68 | return worksheets,worksheet_names 69 | def get_sheets_from_book(origin,workbooks): 70 | # origin is the active origin session 71 | # workbooks is a COM object, string of the workbook name, 72 | # a list of COM objects, or a list of strings 73 | # This can be used to get a list of worksheets which are then passed to 74 | # createGraph_multiwks to create graphs 75 | worksheets=[] 76 | if isinstance(workbooks,str) or isinstance(workbooks,win32com.client.CDispatch): 77 | wb_list = [workbooks] 78 | elif isinstance(workbooks,list): 79 | wb_list = workbooks 80 | else: 81 | print('wrong type of workbooks provided. Must be COM object, string or list') 82 | return 83 | for wb in wb_list: 84 | if isinstance(wb,win32com.client.CDispatch): 85 | # If a COM object, this is already OK 86 | pass 87 | elif isinstance(wb,str): 88 | # If a string, get workbook from name 89 | wb = origin.WorksheetPages(workbook_name) 90 | else: 91 | print('wrong type of workbook provided. Must be COM object or string') 92 | if wb is None: 93 | print('workbook does not exist. Check if name is correct') 94 | else: 95 | for ws in wb.Layers: 96 | worksheets.append(ws) 97 | print('Found ' + str(len(worksheets)) + ' worksheets') 98 | return worksheets 99 | 100 | def connect_to_origin(): 101 | # Connect to Origin client 102 | # OriginExt.Application() forces a new connection 103 | origin = OriginExt.ApplicationSI() 104 | origin.Visible = origin.MAINWND_SHOW # Make session visible 105 | # Session can be later closed using origin.Exit() 106 | # Close previous project and make a new one 107 | # origin.NewProject() 108 | # Wait for origin to compile 109 | # https://www.originlab.com/doc/LabTalk/ref/Second-cmd#-poc.3B_Pause_up_to_the_specified_number_of_seconds_to_wait_for_Origin_OC_startup_compiling_to_finish 110 | origin.Execute("sec -poc 3.5") 111 | time.sleep(3.5) 112 | return origin 113 | 114 | def get_origin_version(origin): 115 | # Get origin version 116 | # Origin 2015 9.2xn 117 | # Origin 2016 9.3xn 118 | # Origin 2017 9.4xn 119 | # Origin 2018 >= 9.50n and < 9.55n 120 | # Origin 2018b >= 9.55n 121 | # Origin 2019 >= 9.60n and < 9.65n (Fall 2019) 122 | # Origin 2019b >= 9.65n (Spring 2020) 123 | return origin.GetLTVar("@V") 124 | 125 | def save_project(origin,project_name,full_path): 126 | # File ending is automatically added by origin 127 | project_name = project_name.replace('.opju','').replace('.opj','') 128 | origin.Execute("save " + os.path.join(full_path,project_name)) 129 | 130 | def matplotlib_to_origin( 131 | fig,ax, 132 | origin=None, 133 | worksheet_name='Sheet',workbook_name='Book', 134 | graph_name='Graph',template_name='LINE.otp', 135 | template_path='OriginTemplates'): 136 | ''' 137 | Inputs: 138 | fig = matplotlib figure object 139 | ax = matplotlib axis object 140 | template = origin template name for desired plot, if exists 141 | templatePath = path on local computer to template folder 142 | origin = origin session, which is returned from previous calls to this program 143 | if passed, a new session will not be created, and graph will be added to 144 | current session 145 | ''' 146 | # If no origin session has been passed, start a new one 147 | if origin==None: 148 | origin = connect_to_origin() 149 | origin_version = get_origin_version(origin) 150 | # Create a workbook page 151 | workbook= origin.CreatePage(2, workbook_name , 'Origin') # 2 for workbook 152 | # get workbook instance from name 153 | wb = origin.WorksheetPages(workbook) 154 | # Get worksheet instance, index starts at 0. Can add more worksheets with wb.Layers.Add 155 | # wb.Layers.Add() for origin_version>2016 156 | ws=wb.Layers(0) 157 | ws.Name=worksheet_name # Set worksheet name 158 | # For now, assume only x and y data for each line (ignore error data) 159 | ws.Cols=len(ax.lines)*2 # Set number of columns in worksheet 160 | 161 | # Make graph page 162 | template=os.path.join(template_path,template_name) # Pick template 163 | graph = origin.CreatePage(3, graph_name, template) # Make a graph with the template 164 | graph_page = origin.GraphPages(graph) # Get graph page 165 | graph_layer = origin.FindGraphLayer(graph) # Get graph layer 166 | data_plots = graph_layer.DataPlots # Get dataplots 167 | # Grouping indices (not yet implemented) 168 | group_start_idx = 0 169 | group_end_idx = 0 170 | for line_idx,line in enumerate(ax.lines): 171 | # Indices for x and y columns 172 | x_col_idx = line_idx * 2 173 | y_col_idx = x_col_idx + 1 174 | col=ws.Columns(x_col_idx) # Get column instance, index starts at 0 175 | # Change column Units, Long Name, or Comments] 176 | col.LongName='X' 177 | col.Units='Unit' 178 | col.Comments='' 179 | col.Type=3 # Set column data type to ( 0=Y, 3=X , ?=X error, ?=Y error) 180 | col=ws.Columns(y_col_idx) 181 | col.Type=0 182 | col.LongName='Y' 183 | col.Units='Unit' 184 | # By default, lines have the label _line# 185 | # If the first character isn't "_", put this label 186 | # In the comments row 187 | if not line.get_label()[0] == '_': 188 | col.Comments = line.get_label() 189 | 190 | origin.PutWorksheet('['+wb.Name+']'+ws.Name, np.float64(line.get_xdata()).tolist(), 0, x_col_idx) # start row, start col 191 | origin.PutWorksheet('['+wb.Name+']'+ws.Name, np.float64(line.get_ydata()).tolist(), 0, y_col_idx) # start row, start col 192 | 193 | # Tested only on origin 2016 and 2018 194 | if origin_version<9.5: # 2016 or earlier 195 | dr = origin.NewDataRange # Make a new datarange 196 | elif origin_version>=9.50: # 2018 or later 197 | dr = origin.NewDataRange() 198 | # Add data to data range 199 | # Column type, worksheet, start row, start col, end row (-1=last), end col 200 | dr.Add('X', ws, 0 , x_col_idx, -1, x_col_idx) 201 | dr.Add('Y', ws, 0 , y_col_idx, -1, y_col_idx) 202 | # Add data plot to graph layer 203 | # 200 -- line 204 | # 201 -- symbol 205 | # 202 -- symbol+line 206 | # Symbols 207 | # https://www.originlab.com/doc/LabTalk/ref/List-of-Symbol-Shapes 208 | # https://www.originlab.com/doc/LabTalk/ref/Options_for_Symbols 209 | #0 = no symbol, 1 = square, 2 = circle, 3 = up triangle, 4 = down triangle, 210 | #5 = diamond, 6 = cross (+), 7 = cross (x), 8 = star (*), 9 = bar (-), 10 = bar (|), 211 | # 11 = number, 12 = LETTER, 13 = letter, 14 = right arrow, 15 = left triangle, 212 | #16 = right triangle, 17 = hexagon, 18 = star, 19 = pentagon, 20 = sphere 213 | # Symbol interior 214 | #0 = no symbol, 1 = solid, 2 = open, 3 = dot center, 4 = hollow, 5 = + center, 215 | # 6 = x center, 7 = - center, 8 = | center, 9 = half up, 10 = half right, 216 | # 11 = half down, 12 = half left 217 | # https://matplotlib.org/api/markers_api.html 218 | mpl_sym_conv = {'s':'1','o':'2','^':'3','v':'4','D':'5','+':'6','x':'7', 219 | '*':'8','_':'9','|':'10','h':'17','p':'19'} 220 | #Line 221 | if plt.getp(line,'marker')=='None': 222 | graph_layer.AddPlot(dr,200) 223 | lc = colors.to_hex(plt.getp(line,'color')) 224 | # Set line color and line width 225 | graph_layer.Execute( 226 | 'range rr = !' + str(line_idx+1) + '; ' + 227 | 'set rr -cl color('+lc+');' + # line color 228 | 'set rr -w 500*'+str(plt.getp(line,'linewidth'))+';') # line width 229 | 230 | #Symbol 231 | elif plt.getp(line,'linestyle')=='None': 232 | graph_layer.AddPlot(dr,201) # Previously data_plots.Add() 233 | # Set symbol size, edge color, face color 234 | mec = colors.to_hex(plt.getp(line,'mec')) 235 | mfc = colors.to_hex(plt.getp(line,'mfc')) 236 | graph_layer.Execute( 237 | 'range rr = !' + str(line_idx+1) + '; ' + 238 | 'set rr -k '+mpl_sym_conv[plt.getp(line,'marker')]+';' + # symbol type 239 | 'set rr -kf 2;' + # symbol interior 240 | 'set rr -z '+str(plt.getp(line,'ms'))+';' + # symbol size 241 | 'set rr -c color('+mec+');'+ # edge color 242 | 'set rr -cf color('+mfc+');'+ # face color 243 | 'set rr -kh 10*'+str(plt.getp(line,'mew'))+';')# edge width 244 | #Line+Symbol 245 | else: 246 | graph_layer.AddPlot(dr,202) 247 | # Set symbol size, edge color, face color 248 | lc = colors.to_hex(plt.getp(line,'color')) 249 | mec = colors.to_hex(plt.getp(line,'mec')) 250 | mfc = colors.to_hex(plt.getp(line,'mfc')) 251 | graph_layer.Execute( 252 | 'range rr = !' + str(line_idx+1) + '; ' + 253 | 'set rr -k '+mpl_sym_conv[plt.getp(line,'marker')]+';' + # symbol type 254 | 'set rr -kf 2;' + # symbol interior 255 | 'set rr -z '+str(plt.getp(line,'ms'))+';' + # symbol size 256 | 'set rr -c color('+mec+');'+ # edge color 257 | 'set rr -cf color('+mfc+');'+ # face color 258 | 'set rr -kh 10*'+str(plt.getp(line,'mew'))+';' + # edge width 259 | 'set rr -cl color('+lc+');' + # line color 260 | 'set rr -w 500*'+str(plt.getp(line,'linewidth'))+';') # line width 261 | 262 | 263 | 264 | # For labtalk documentation of graph formatting, see: 265 | # https://www.originlab.com/doc/LabTalk/guide/Formatting-Graphs 266 | # https://www.originlab.com/doc/LabTalk/ref/Layer-Axis-Label-obj 267 | # For matplotlib documentation, see: 268 | # https://matplotlib.org/api/axes_api.html 269 | # Get figure dimensions 270 | # Set figure dimensions 271 | # Get axes ranges 272 | x_axis_range = ax.get_xlim() 273 | y_axis_range = ax.get_ylim() 274 | # Get axes scale types 275 | x_axis_scale = ax.get_xscale() 276 | y_axis_scale = ax.get_yscale() 277 | # Get axes labels 278 | x_axis_label = ax.get_xlabel() 279 | y_axis_label = ax.get_ylabel() 280 | title = ax.get_title() 281 | # Set axes titles (xb for bottom axis, yl for left y-axis, etc.) 282 | graph_layer.Execute('label -xb ' + x_axis_label + ';') 283 | graph_layer.Execute('label -yl ' + y_axis_label + ';') 284 | # Set fontsizes 285 | #graph_layer.Execute('layer.x.label.pt = 12;') 286 | #graph_layer.Execute('layer.y.label.pt = 12;') 287 | #graph_layer.Execute('xb.fsize = 16;') 288 | #graph_layer.Execute('yl.fsize = 16;') 289 | 290 | # Set axis scales 291 | set_axis_scale(graph_layer,axis='x',scale=x_axis_scale) 292 | set_axis_scale(graph_layer,axis='y',scale=y_axis_scale) 293 | # Set axis ranges 294 | graph_layer.Execute('layer.x.from = ' + str(x_axis_range[0]) + '; ' + 295 | 'layer.x.to = ' + str(x_axis_range[1]) + ';') 296 | 297 | graph_layer.Execute('layer.y.from = '+str(y_axis_range[0])+'; '+ 298 | 'layer.y.to = '+str(y_axis_range[1])+';') 299 | 300 | # Set page dimensions based on figure size 301 | figure_size_inches = fig.get_size_inches() 302 | graph_page.SetWidth(figure_size_inches[0]) 303 | graph_page.SetHeight(figure_size_inches[1]) 304 | # graph_page.Execute('page.width= page.resx*'+str(figure_size_inches[0])+'; '+ 305 | # 'page.height= page.resy*'+str(figure_size_inches[1])+';') 306 | # Units 1 = % page, 2 = inches, 3 = cm, 4 = mm, 5 = pixel, 6 = points, and 7 = % of linked layer. 307 | # graph_layer.Execute('layer.unit=2; ' + 308 | # 'layer.width='+str(figure_size_inches[0])+'; '+ 309 | # 'layer.height='+str(figure_size_inches[1])+';') 310 | # Group each column (This allows colors to be automatically incremented 311 | # and a single legend entry to be created for all the data sets with 312 | # the same legend entry) 313 | #graph_layer.Execute('layer -g ' + str(group_start_idx) + ' ' + str(group_end_idx) + ';') 314 | #graph_layer.Execute('Rescale') 315 | graph_layer.Execute('legend -r') # re-construct legend 316 | return origin 317 | 318 | def numpy_to_origin( 319 | data_array,column_axis=0,types=None, 320 | long_names=None,comments=None,units=None, 321 | user_defined=None,origin=None, 322 | worksheet_name='Sheet',workbook_name='Book'): 323 | ''' 324 | Sends 2d numpy array to originlab worksheet 325 | Inputs: 326 | data_array = numpy array object 327 | column_axis = integer (0 or 1) for axis to interpret as worksheet columns 328 | long_names,comments,units = lists for header rows, length = # of columns 329 | user_defined = list of (key,value) tuples for metadata for a sheet 330 | e.g. [('Test Date','2019-01-01'),('Device Label','A12')] 331 | origin = origin session, which is returned from previous calls to this program 332 | if passed, a new session will not be created, and graph will be added to 333 | current session 334 | origin_version = 2016 other year, right now >2016 handles DataRange differently 335 | types = column types, either 'x','y','x_err','y_err','z','label', or 'ignore' 336 | ''' 337 | # If no origin session has been passed, start a new one 338 | if origin==None: 339 | origin = connect_to_origin() 340 | origin_version = get_origin_version(origin) 341 | # Check if workbook exists. If not create a new workbook page with this name 342 | layer_idx=None 343 | if origin.WorksheetPages(workbook_name) is None: 344 | workbook_name = origin.CreatePage(2, workbook_name , 'Origin') # 2 for workbook 345 | # Use Sheet1 if workbook is newly made 346 | layer_idx=0 347 | # get workbook instance from name 348 | wb = origin.WorksheetPages(workbook_name) 349 | if layer_idx is None: 350 | wb.Layers.Add() # Add a worksheet 351 | #then find the last worksheet to modify (to avoid overwriting other data) 352 | layer_idx = wb.Layers.Count - 1 353 | ws=wb.Layers(layer_idx) # Get worksheet instance, index starts at 0. 354 | ws.Name=worksheet_name # Set worksheet name 355 | # For now, assume only x and y data for each line (ignore error data) 356 | ws.Cols=data_array.shape[column_axis] # Set number of columns in worksheet 357 | # Change column Units, Long Name, or Comments] 358 | for col_idx in range(0,data_array.shape[column_axis]): 359 | col=ws.Columns(col_idx) # Get column instance, index starts at 0 360 | # Go through, check that each value exists and add to worksheet 361 | if (not long_names is None) and (len(long_names)>col_idx): 362 | col.LongName=long_names[col_idx] 363 | if (not units is None) and (len(units)>col_idx): 364 | col.Units=units[col_idx] 365 | if (not comments is None) and (len(comments)>col_idx): 366 | col.Comments=comments[col_idx] 367 | if not (types is None) and (len(types)>col_idx): 368 | type_str_to_int={'x':3,'y':0,'x_err':6,'y_err':2,'label':4,'z':5,'ignore':1} 369 | # Set column data type to (0 = Y, 1 = disregard, 2 = Y Error, 3 = X, 4 = Label, 5 = Z, and 6 = X Error.) 370 | # documentation here is off by one https://www.originlab.com/doc/LabTalk/ref/Wks-Col-obj 371 | col.Type=type_str_to_int[types[col_idx].lower()] 372 | # Check dimensionality off array. 373 | # If one dimensional, each element is assumed to be a column 374 | # If two dimensional, check 375 | # other dimensions are not supported. 376 | if data_array.ndim == 2: 377 | if column_axis == 0: 378 | origin.PutWorksheet('['+wb.Name+']'+ws.Name, np.float64(data_array[col_idx,:]).tolist(), 0, col_idx) # start row, start col 379 | elif column_axis == 1: 380 | origin.PutWorksheet('['+wb.Name+']'+ws.Name, np.float64(data_array[:,col_idx]).tolist(), 0, col_idx) # start row, start col 381 | elif data_array.ndim == 1: 382 | origin.PutWorksheet('['+wb.Name+']'+ws.Name, np.float64(data_array[col_idx]).tolist(), 0, col_idx) # start row, start col 383 | else: 384 | print('only 1 and 2 dimensional arrays supported') 385 | #origin.PutWorksheet('['+wb.Name+']'+ws.Name, np.float64(data_array).T.tolist(), 0, col_idx) # start row, start col 386 | if not user_defined is None: 387 | # User Param Rows 388 | for idx,param in enumerate(user_defined): 389 | ws.Execute('wks.UserParam' + str(idx+1) + '=1; wks.UserParam' + str(idx+1) + '$="' + param[0] + '";') 390 | ws.Execute('col(1)[' + param[0] + ']$="' + param[1] + '";') 391 | origin.Execute('wks.col1.width=10;') 392 | return origin,wb,ws 393 | 394 | def createGraph_multiwks(origin,graph_name,template,templatePath,worksheets,x_cols,y_cols, 395 | LineOrSym=None,auto_rescale=True, 396 | x_scale=None,y_scale=None,x_label=None,y_label=None, 397 | figsize=None): 398 | ''' 399 | worksheets must be a list of worksheets 400 | Each worksheet must have same order of columns 401 | template is the full path and template filename 402 | x_cols, y_cols, and LineOrSym should be lists of same length 403 | each element of list is a different variable/column to plot 404 | x_col can be a single element list or an integer, and then the same value of x_col 405 | will be applied to every y_col 406 | auto_rescale is a bool. If true, axes scales will automatically re-scales 407 | x_scale, y_scale can be None (use origin default), "linear" or "log" 408 | x_label, y_label can be None (use template default) or string 409 | ''' 410 | origin_version = get_origin_version(origin) 411 | # Create graph page and object 412 | templateFullPath=os.path.join(templatePath,template) 413 | # Create graph if doesn't already exist 414 | graph_layer = origin.FindGraphLayer(graph_name) 415 | if graph_layer is None: 416 | graph_name = origin.CreatePage(3, graph_name, templateFullPath) 417 | # Find the graph layer 418 | graph_layer = origin.FindGraphLayer(graph_name) 419 | # Check length of x_cols and y_cols 420 | if isinstance(x_cols, list) and isinstance(y_cols, list): 421 | if not len(x_cols)==len(y_cols): 422 | print('length of x_cols != length of y_cols. Assuming same x_col for all y_cols') 423 | x_cols = [x_cols[0]]*len(y_cols) 424 | # if integer provided for x_cols but list for y_cols, assume same x_cols for all y_cols 425 | elif isinstance(x_cols, int) and isinstance(y_cols, list): 426 | x_cols = [x_cols]*len(y_cols) 427 | elif isinstance(x_cols, int) and isinstance(y_cols, int): 428 | x_cols,y_cols = [x_cols],[y_cols] # convert to lists 429 | # If LineOrSym not provided, assume line 430 | if LineOrSym is None: 431 | LineOrSym = ['Line']*len(y_cols) 432 | elif isinstance(LineOrSym, str): 433 | LineOrSym = [LineOrSym]*len(y_cols) 434 | # Get dataplot collection from the graph layer 435 | dataPlots = graph_layer.DataPlots 436 | 437 | # Add data column by column to the graph 438 | # loop over worksheets within column loops so that data from same column 439 | # can be grouped. E.g. all PL data is in same column and will be grouped. 440 | for ci,x_col in enumerate(x_cols): 441 | for wi,worksheet in enumerate(worksheets): 442 | # Create a data range 443 | # Tested only on origin 2016 and 2018 444 | if origin_version<9.5: # 2016 or earlier 445 | dr = origin.NewDataRange # Make a new datarange 446 | elif origin_version>=9.50: # 2018 or later 447 | dr = origin.NewDataRange() 448 | 449 | # Add data to data range 450 | # worksheet, start row, start col, end row (-1=last), end col 451 | dr.Add('X', worksheet, 0 , x_col, -1, x_col) 452 | dr.Add('Y', worksheet, 0 , y_cols[ci], -1, y_cols[ci]) 453 | # Add data plot to graph layer 454 | # list of types: https://www.originlab.com/doc/LabTalk/ref/Plot-Type-IDs 455 | # 200 -- line 456 | # 201 -- symbol 457 | # 202 -- symbol+line 458 | # If specified, plot symbol. By default, plot line 459 | # https://www.originlab.com/doc/python/PyOrigin/Classes/GraphLayer-AddPlot 460 | if LineOrSym[ci] in ['Sym','Symbol','Symbols']: 461 | graph_layer.AddPlot(dr, 201) 462 | # Method when using win32com to connect 463 | #dataPlots.Add(dr, 201) 464 | elif LineOrSym[ci] == 'Line+Sym': 465 | graph_layer.AddPlot(dr,202) 466 | #dataPlots.Add(dr, 202) 467 | else: 468 | graph_layer.AddPlot(dr, 200) 469 | #dataPlots.Add(dr, 200) 470 | # Group each column (This allows colors to be automatically incremented 471 | # and a single legend entry to be created for all the data sets with 472 | # the same legend entry) 473 | BeginIndex = ci*len(worksheets) + 1; 474 | EndIndex = BeginIndex + len(worksheets) - 1; 475 | graph_layer.Execute('layer -g ' + str(BeginIndex) + ' ' + str(EndIndex) + ';') 476 | 477 | graph_layer.Execute('legend -r') 478 | 479 | # Set axes scales 480 | set_axis_scale(graph_layer,axis='x',scale=x_scale) 481 | set_axis_scale(graph_layer,axis='y',scale=y_scale) 482 | 483 | # Set axes titles (xb for bottom axis, yl for left y-axis, etc.) 484 | if not x_label is None: 485 | graph_layer.Execute('label -xb ' + x_label + ';') 486 | if not y_label is None: 487 | graph_layer.Execute('label -yl ' + y_label + ';') 488 | 489 | # Rescales axes 490 | #Rescale type: 1 = manual, 2 = normal, 3 = auto, 4 = fixed from, and 5 = fixed to. 491 | #graph_layer.Execute('layer.axis.rescale=3') 492 | if auto_rescale: 493 | graph_layer.Execute('Rescale') 494 | if not figsize is None: 495 | graph_page.SetWidth(figsize[0]) 496 | graph_page.SetHeight(figsize[1]) 497 | return graph_name 498 | # To exit, call origin.Exit() 499 | 500 | # Could try to format from standard matplotlib keyword arguments, such as: 501 | # figsize, markersize 502 | # def format_from_mpl_kwargs(graph_page,graph_layer,**kwargs): 503 | # # Set figure size in inches 504 | # if figsize in kwargs.keys(): 505 | # graph_page.SetWidth(figsize[0]) 506 | # graph_page.SetHeight(figsize[1]) 507 | 508 | ''' 509 | Miscellaneous methods and commands that could be useful: 510 | 511 | Setting and getting height and width of graph page: 512 | origin.GraphPages(i).Height = 4 513 | origin.GraphPages(i).Width = 6 514 | 515 | Get number of workbooks, pages, etc. 516 | origin.WorksheetPages.Count 517 | origin.GraphPages.Count 518 | etc. 519 | 520 | Get the parent workbook of a worksheet 521 | worksheets[0].Parent.Name 522 | This also works to get the parent with graph layers 523 | (more docs here https://www.originlab.com/doc/COM/Classes/) 524 | ''' 525 | --------------------------------------------------------------------------------