Changeset 1183 for trunk/User Procedures/Irena/IR2_DataExport.ipf
- Timestamp:
- Jan 23, 2022 5:55:32 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/User Procedures/Irena/IR2_DataExport.ipf
r1180 r1183 725 725 Duplicate/O TempY, NoteTempY 726 726 string OldNoteT=note(TempY) 727 // wvlgth = NumberByKey("Nika_Wavelength", OldNoteT1 , "=", ";") 728 // if(numtype(wvlgth)!=0) 729 // wvlgth = NumberByKey("Wavelength", OldNoteT1 , "=", ";") 730 // if(numtype(wvlgth)!=0) 731 // Prompt wvlgth, "Wavelength not found, please, provide" 732 // DoPrompt "Provide wavelength is A", wvlgth 733 // if (V_Flag || numtype(wvlgth)!=0 || wvlgth<0.01) 734 // return -1 // User canceled 735 // endif 736 // endif 737 // endif 738 727 739 note/K NoteTempY 728 740 note NoteTempY, OldNoteT+"Exported="+date()+" "+time()+";" … … 738 750 Duplicate/O TempE, Uncertainty 739 751 endif 740 if(reduceOutputPrecision)741 Redimension/S Qvector_A,Intensity742 if(HaveErrors)743 Redimension/S Uncertainty744 endif745 endif746 752 747 753 OldNoteT1=note(Intensity) 748 wvlgth = NumberByKey("Nika_Wavelength", OldNoteT1 , "=", ";")749 if(numtype(wvlgth)!=0)750 wvlgth = NumberByKey("Wavelength", OldNoteT1 , "=", ";")751 if(numtype(wvlgth)!=0)752 Prompt wvlgth, "Wavelength not found, please, provide"753 DoPrompt "Provide wavelength is A", wvlgth754 if (V_Flag || numtype(wvlgth)!=0 || wvlgth<0.01)755 return -1 // User canceled756 endif757 endif758 endif759 754 760 755 //convert q tth or d into what is asked for... … … 765 760 elseif(StringMatch(QWavename, "d_*") || StringMatch(QWavename, "'d_*")) //d wave 766 761 //q = 2pi/d 767 TempXC Onverted = 2*pi / TempX762 TempXConverted = 2*pi / TempX 768 763 else //Two theta wave, convert to Q 769 764 //q = 4pi sin(theta)/lambda 765 wvlgth = IR2E_GetWavelength(OldNoteT1) 770 766 TempXConverted = 4*pi*sin(TempX/(2 * 180/pi)) / wvlgth 771 767 endif 772 768 Duplicate/O TempXConverted,Qvector_A 769 //reduce precision here... 770 if(reduceOutputPrecision) 771 Redimension/S Qvector_A,Intensity 772 if(HaveErrors) 773 Redimension/S Uncertainty 774 endif 775 endif 776 773 777 if(HaveErrors) 774 778 Save/A=2/G/W/M="\r\n"/P=IR2E_ExportPath Qvector_A,Intensity,Uncertainty as FinalOutputName … … 787 791 //TTH = 114.592 * asin((2*pi/D) * wvlgth /(4*pi)) 788 792 //D = 2*pi/(4*pi)*sin(TTH/114.592)/wvlgth 793 wvlgth = IR2E_GetWavelength(OldNoteT1) 789 794 TempXConverted = 1/(2*sin(TempX/(2 * 180/pi))/ wvlgth) 790 795 endif 791 796 Duplicate/O TempXConverted,Dspacing_A 797 //reduce precision here... 798 if(reduceOutputPrecision) 799 Redimension/S Dspacing_A,Intensity 800 if(HaveErrors) 801 Redimension/S Uncertainty 802 endif 803 endif 792 804 if(HaveErrors) 793 805 Save/A=2/G/W/M="\r\n"/P=IR2E_ExportPath Dspacing_A,Intensity,Uncertainty as FinalOutputName … … 798 810 if(StringMatch(QWavename, "q_*") || StringMatch(QWavename, "'q_*")||StringMatch(QWavename, "*_Qvec")) //q wave 799 811 //TwoTheta = 2* asin(q * lambda /4pi) 812 wvlgth = IR2E_GetWavelength(OldNoteT1) 800 813 TempXCOnverted = 114.592 * asin(TempX * wvlgth /(4*pi)) 801 814 elseif(StringMatch(QWavename, "d_*") || StringMatch(QWavename, "'d_*")) //d wave 802 815 //TwoTheta = 2* asin(q * lambda /4pi), Q = 2*pi/D 816 wvlgth = IR2E_GetWavelength(OldNoteT1) 803 817 TempXCOnverted = 114.592 * asin((2*pi/TempX) * wvlgth /(4*pi)) 804 818 else //Two theta wave, convert to d … … 806 820 endif 807 821 Duplicate/O TempXConverted,TwoTheta_Deg 822 //reduce precision here... 823 if(reduceOutputPrecision) 824 Redimension/S TwoTheta_Deg,Intensity 825 if(HaveErrors) 826 Redimension/S Uncertainty 827 endif 828 endif 808 829 if(HaveErrors) 809 830 Save/A=2/G/W/M="\r\n"/P=IR2E_ExportPath TwoTheta_Deg,Intensity,Uncertainty as FinalOutputName … … 858 879 note/K NoteTempY 859 880 note NoteTempY, OldNoteT1+"Exported="+date()+" "+time()+";" 860 wvlgth = NumberByKey("Nika_Wavelength", OldNoteT1 , "=", ";")861 if(numtype(wvlgth)!=0)862 wvlgth = NumberByKey("Wavelength", OldNoteT1 , "=", ";")863 if(numtype(wvlgth)!=0)864 Prompt wvlgth, "Wavelength not found, please, provide"865 DoPrompt "Provide wavelength is A", wvlgth866 if (V_Flag || numtype(wvlgth)!=0 || wvlgth<0.01)867 return -1 // User canceled868 endif869 endif870 endif881 // wvlgth = NumberByKey("Nika_Wavelength", OldNoteT1 , "=", ";") 882 // if(numtype(wvlgth)!=0) 883 // wvlgth = NumberByKey("Wavelength", OldNoteT1 , "=", ";") 884 // if(numtype(wvlgth)!=0) 885 // Prompt wvlgth, "Wavelength not found, please, provide" 886 // DoPrompt "Provide wavelength is A", wvlgth 887 // if (V_Flag || numtype(wvlgth)!=0 || wvlgth<0.01) 888 // return -1 // User canceled 889 // endif 890 // endif 891 // endif 871 892 //convert q or d into two theta as needed... 872 893 Duplicate/Free tempX, TempXCOnverted 873 894 if(StringMatch(QWavename, "q_*") || StringMatch(QWavename, "'q_*")||StringMatch(QWavename, "*_Qvec")) //q wave 895 wvlgth = IR2E_GetWavelength(OldNoteT1) 874 896 TempXCOnverted = 2 * 180/pi * asin(TempX * wvlgth /(4*pi)) 875 897 elseif(StringMatch(QWavename, "d_*") || StringMatch(QWavename, "'d_*")) //d wave 898 wvlgth = IR2E_GetWavelength(OldNoteT1) 876 899 TempXCOnverted = 2 * 180/pi * (wvlgth / (2*TempX)) 877 900 else //Two theta wave nothing needed... … … 885 908 InsertPoints numpnts(WaveNoteWave), 2, WaveNoteWave 886 909 WaveNoteWave[0] = "/*" 910 wvlgth = IR2E_GetWavelength(OldNoteT1) 887 911 WaveNoteWave[1] = HeaderSeparator+"wavelength = "+num2str(wvlgth) 888 912 WaveNoteWave[numpnts(WaveNoteWave)-2] = "# 2Theta Intensity Error" … … 926 950 //******************************************************************************************************************************* 927 951 //******************************************************************************************************************************* 952 static Function IR2E_GetWavelength(OldNoteT1) 953 string OldNoteT1 954 955 DFref oldDf= GetDataFolderDFR() 956 setDataFolder root:Packages:IR2_UniversalDataExport 957 variable wvlgth 958 NVAR/Z TempExportwvlgth //this is buffer of wavelength value if users chooses to store it. 959 string KeepwVlgth = "No" 960 961 wvlgth = NumberByKey("Nika_Wavelength", OldNoteT1 , "=", ";") 962 if(numtype(wvlgth)!=0) 963 wvlgth = NumberByKey("Wavelength", OldNoteT1 , "=", ";") 964 if(numtype(wvlgth)!=0) 965 //check if we have stored one here... 966 if(NVAR_Exists(TempExportwvlgth)) 967 wvlgth = TempExportwvlgth 968 print "*** Using previously user input wavelentgh of "+num2str(wvlgth)+" A for current data set. *** " 969 print "If this is wrong, type in command line : \"Killvariables root:Packages:IR2_UniversalDataExport:TempExportwvlgth \"." 970 print "*** And re-export the data, you will get wavelength input dialog again ***" 971 else 972 Prompt wvlgth, "Wavelength not found, please, provide" 973 Prompt KeepwVlgth, "Store for future use? Must be same for all data!", popup, "No;Yes;" 974 DoPrompt "Provide wavelength is A", wvlgth, KeepwVlgth 975 if (V_Flag || numtype(wvlgth)!=0 || wvlgth<0.01) 976 return -1 // User canceled 977 endif 978 print "*** Using user input wavelentgh of "+num2str(wvlgth)+" A for current data set. *** " 979 if(StringMatch(KeepwVlgth, "Yes")) 980 variable/g TempExportwvlgth 981 TempExportwvlgth = wvlgth 982 print "*** Stored user input wavelentgh of "+num2str(wvlgth)+" A for use for all data sets. *** " 983 endif 984 endif 985 endif 986 endif 987 988 setDataFolder oldDF 989 return wvlgth 990 end 991 928 992 //******************************************************************************************************************************* 929 993 //*******************************************************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.