




已阅读5页,还剩45页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
UsingIDLandPythonwithEPICS,MarkRivers,UniversityofChicago,2,Outline,QuickOverviewofIDLezcalibraryCallingezcafromIDLIDLCAAPIIDLEPICSclasslibrariesIDLapplicationsOverviewofPythonPythonclasslibrariesPythonapplicationsUsingEPICSfromVisualBasic,3,OverviewofIDL,Ahigh-levelinterpretedprogramminglanguagewithvectorandarrayprimitives-sortofacrossbetweenBASICandAPLModernprogramminglanguageFlowcontrolDatastructuresObjectsAlloperatorsandmostfunctionsworkonscalar,vectororarraydataofanydatatype.Datavisualizationtool,advancedbuilt-ingraphics2-DplotsContourplotsSurfaceplotsShadedsurfacesGrayscale/colorimagesIsosurfacesVolumerenderingMulti-platformsupportUnix:Sun,HewlettPackard,SiliconGraphics,IBMLinuxMicrosoftWindowsMacDarwinListprice:$3,000onworkstations,$1,500onPC,Mac,4,OverviewofIDL,CancallexternalCorothercodeVeryfastforarrayoperations,asfastascompiledlanguagesGUIbuilderMulti-threadedGoodvendorsupportIDLGUIapplicationscanberunatnocost(IDL6.0andabove)MusthavelicensetouseIDLcommandline,5,OverviewofIDL,DataStructuresAvariableinIDLhasbothastructureandadatatypeassociatedwithit.Bothofthesearedynamic,i.e.theycanbechangedviaanassignmentstatementatanytime.DatatypesByte(bbit,unsigned)Integer(16bit,signed)Long(32bit,signed)Float(32bitfloatingpoint)Double(64bitfloatingpoint)Complex(pairof32bitfloats)Doublecomplex(pairof64bitfloats)String(0to64kcharacters)DataStructuresScalarVectorArray-upto7dimensionsStructure-composedofotherelements,likeCThesizesofarraysarelimitedonlybytheavailablevirtualmemory.,6,OverviewofIDL,AssignmentStatementsA=B+1AhasthesamestructureasB,withadatatypeequaltothatofthemostpreciseoperandintheexpressionontherighthandside.Inthiscaseitcouldbeanytypeexceptstring.IfBisavectororarraythen1isaddedtoeachelement.A=0;Aisa16bitintegerA=A*0.5;Aisnowa32bitfloatB=A(*,3);Bisequaltothe4throwofAA(*,3)=0;Setallelementsin4throwofAequalto0SyntaxExamples:image=fltarr(512,512);zerofilledarrayb=image(0:127,0:127);bis128x128arrayimage(*,100)=findgen(512);replacerow100plot,image(*,120);plotrow121;Displaythepowerspectrumasanimagetvscl,alog(abs(fft(image,1),7,IDLExamples,IDLa=sin(findgen(100)/99.*2*!pi)IDLhelp,aAFLOAT=Array100IDLplot,a,8,IDLExamples,IDLa=shift(alog(abs(fft(dist(256),1),128,128)IDLisurface,a,9,ezcaandEzcaScan,EPICSextensionsfor“EasyChannelAccess”Dontneedtohandlechids,justusePVnamestringshashtableSynchronousAPIs-applicationsdonthavetohandlecallbacksEzca(partiallist)epicsShareFuncintepicsShareAPIezcaGet(char*pvname,charezcatype,intnelem,void*data_buff);epicsShareFuncintepicsShareAPIezcaPut(char*pvname,charezcatype,intnelem,void*data_buff);epicsShareFuncintepicsShareAPIezcaPutOldCa(char*pvname,charezcatype,intnelem,void*data_buff);epicsShareFuncintepicsShareAPIezcaNewMonitorValue(char*pvname,charezcatype);/*returnsTRUE/FALSE*/epicsShareFuncintepicsShareAPIezcaSetTimeout(floatsec);epicsShareFuncfloatepicsShareAPIezcaGetTimeout(void);epicsShareFuncintepicsShareAPIezcaSetRetryCount(intretry);epicsShareFuncintepicsShareAPIezcaGetRetryCount(void);epicsShareFuncintepicsShareAPIezcaPvToChid(char*pvname,chid*cid);epicsShareFuncintepicsShareAPIezcaSetMonitor(char*pvname,charezcatype);epicsShareFuncintepicsShareAPIezcaClearMonitor(char*pvname,charezcatype);epicsShareFuncintepicsShareAPIezcaStartGroup(void);epicsShareFuncintepicsShareAPIezcaEndGroup(void);epicsShareFuncintepicsShareAPIezcaGetControlLimits(char*pvname,double*low,double*high);epicsShareFuncintepicsShareAPIezcaGetGraphicLimits(char*pvname,double*low,double*high);epicsShareFuncintepicsShareAPIezcaGetNelem(char*pvname,int*nelem);epicsShareFuncintepicsShareAPIezcaGetPrecision(char*pvname,short*precision);epicsShareFuncintepicsShareAPIezcaGetStatus(char*pvname,TS_STAMP*timestamp,short*status,short*severity);epicsShareFuncintepicsShareAPIezcaGetUnits(char*pvname,char*units);/*unitsmustbeatleastEZCA_UNITS_SIZElarge*/,10,ezcaandEzcaScan,EzcaScan(partiallist)epicsShareFuncintepicsShareAPIEzca_getArray(intnoName,char*pvName,inttype,intnodata,void*value);epicsShareFuncintepicsShareAPIEzca_getArrayEvent(intnoName,char*pvName,inttype,intnodata,void*value);epicsShareFuncintepicsShareAPIEzca_putArray(intnoName,char*pvName,inttype,intnodata,void*value);epicsShareFuncintepicsShareAPIEzca_putArrayEvent(intnoName,char*pvName,inttype,intnodata,void*value);,11,ezcaandIDL,IDLcancall“shareablelibraries”,e.g.sofilesonUnix,.dllfilesonWindowsTheargumentpassingconventionisfixed,itisnotcompatiblewithezca.dlldirectlyNeedathingluelayerbetweenIDLandezca/EzcaScanezcaIDListhegluelayer.Mostlyjustchangescallingconventions.ProvidesafewfunctionsthatezcaandEzcaScandonot.UsetheezcaPvToChid()function.ezcaIDLGetEnumStrings()ezcaIDLGetCountAndType(),12,IDLChannelAccessAPI,RoutineswhichreturninformationaboutprocessvariablesStatus=caGet(pvname,value,/string,maximum=max)Status=caGetControlLimits(pvname,low,high)Status=caGetGraphicLimits(pvname,low,high)Status=caGetPrecision(pvname,precision)Status=caGetStatus(pvname,timestamp,status,severity)Status=caGetUnits(pvname,units)Status=caGetEnumStrings(pvname,strings)Status=caGetCountAndType(pvname,count,type)RoutineswhichwritenewvaluestoprocessvariablesStatus=caPut(pvname,value,wait=wait)RoutineswhichcontrolchannelaccesstimeoutsTimeout=caGetTimeout()caSetTimeout,timeoutRetryCount=caGetRetryCount()caSetRetryCount,retrycount,13,IDLChannelAccessAPI,RoutineswhichcontrolsynchronousgroupscaStartGroupstat=caEndGroup(status)RoutineswhichcontrolchannelaccessmonitorsStatus=caSetMonitor(pvname)Status=caClearMonitor(pvname)State=caCheckMonitor(pvname)RoutineswhichcontroldebugginganderrormessagescaDebug,statecaTrace,statecaError,err_string,/ON,/OFF,/PRINT,prefix=prefixDocumentationat/software/idl/ezcaIDLGuide.html/software/idl/ezcaIDLRef.html,14,IDLEPICSExamples,IDLstatus=caget(13LAB:m1.VAL,position)IDLhelp,status,positionSTATUSLONG=0POSITIONDOUBLE=517.19305IDLstatus=caget(13LAB:quadEM:mca1,spectrum)IDLplot,spectrumIDLhelp,status,spectrumSTATUSLONG=0SPECTRUMLONG=Array2048IDLplot,spectrum0:500IDLfft_data=alog(abs(fft(spectrum,1)IDLplot,fft_data,xrange=0,1023,15,IDLEPICSExamples,MoveamotorDLstatus=caput(13LAB:m8.VAL,10000)IDLstatus=caget(13LAB:m8.RBV,pos)IDLprint,pos215.52734IDLstatus=caget(13LAB:m8.RBV,pos)IDLprint,pos835.64453IDLstatus=caget(13LAB:m8.RBV,pos)IDLprint,pos1795.6055Ezcatimeoutvaluesareimportant!IDLprint,cagettimeout()0.0200000IDLt0=systime(1)Movetoabsoluteposition10.IDLmotor-wait;Waitforittogetthere,18,IDLEPICSClassLibraries,Exampleofepics_mcaIDLmca=obj_new(epics_mca,13LAB:aim_adc1)IDLmca-eraseIDLmca-acquire_onIDLdata=mca-get_data()IDLplot,dataExampleofepics_scalerIDLscaler=obj_new(epics_scaler,13LAB:scaler1)IDLscaler-start,10.;Countfor10secondsIDLscaler-wait;WaitforittogetdoneIDLcounts=scaler-read();ReadthecountsoneachchannelIDLprint,counts1000000000000000,19,IDLEPICSClassLibraries,epics_sscanDesignedtodothefollowing:Provideanobject-orientedinterfacetostandardEPICSscans,enablinguserwrittensoftwaretoeasilyaccessscanheaderinformationanddata.ProvideaneasywaytoreadMDAfileswrittenbythesaveDatafunctioninsynApps.ProvideaneasywaytogetscandataintotheIDLiToolssystem.iToolsprovidepowerfulinterfacesforvisualizingdata,zoomingin,addingannotation,andproducingpublicationqualityplots.Provideawaytoconvertbinaryscanfiles(e.g.MDA)intoASCIIDoesnotcurrentlycommunicatewiththeIOCforreal-timedata,butthisisplannedforthefuture,20,IDLEPICSClassLibraries,Example:Simple1Depics_sscanIDLs=read_mda(13IDC_0027.mda);ReadthedataIDLs-display;Displaythefirstdetector,21,IDLEPICSClassLibraries,Example:2-Depics_sscanIDLs=read_mda(2idd_0087.mda);Readthe2-DdatasetIDLs-display,/all,/grid;Displayalloftheimagesinagrid,22,IDLEPICSClassLibraries,Example:2-Depics_sscan;Plotaprofileofcolumn20(X=20)indetector15.IDLs-display,detector=15,xrange=20,23,Documentation:ReferencemanualforeachclasslibraryEPICS_MCAClassThispagewascreatedbytheIDLlibraryroutinemk_html_help.Formoreinformationonthisroutine,refertotheIDLOnlineHelpNavigatorortype:?mk_html_helpattheIDLcommandlineprompt.Lastmodified:SatJul1410:16:052001.ListofRoutinesEPICS_MCA:ACQUIRE_OFFEPICS_MCA:ACQUIRE_ONEPICS_MCA:ACQUIRE_WAITEPICS_MCA:ADD_ROIEPICS_MCA:DEL_ROIEPICS_MCA:ERASEEPICS_MCA:GET_ACQUIRE_STATUSEPICS_MCA:GET_CALIBRATIONEPICS_MCA:GET_DATAEPICS_MCA:GET_ELAPSEDEPICS_MCA:GET_PRESETSEPICS_MCA:GET_ROISEPICS_MCA:GET_ROI_COUNTSEPICS_MCA:GET_SEQUENCEEPICS_MCA:INITEPICS_MCA:SET_CALIBRATIONEPICS_MCA:SET_DATAEPICS_MCA:SET_PRESETSEPICS_MCA:SET_ROISEPICS_MCA:SET_SEQUENCEEPICS_MCA:SPECTRA_SCANEPICS_MCA:WRITE_FILEEPICS_MCA_DEFINERELEASENOTESDocumentationat:/software/idl/,IDLEPICSClassLibraries,EPICS_MCA:GET_DATAPreviousRoutineNextRoutineListofRoutinesNAME:EPICS_MCA:GET_DATAPURPOSE:ThisfunctionreturnsthedatafromtheMCA.CATEGORY:EPICSdeviceclasslibrary.CALLINGSEQUENCE:Result=epics_mca-GET_DATA()KEYWORD_PARAMETERS:CHECK_NEW:Aflagwhichindicatesthatthisroutineshouldonlyreturnthedataifithaschanged.OPTIONALOUTPUTS:NEW_FLAG:IfCHECK_FLAGisset,thenNEW_FLAGwillbe1ifthefunctionisreturningnewdata,0ifthefunctionisnotreturningnewdata.IfCHECK_FLAGissetandNEW_FLAGis0thenthefunctionreturns-1.PROCEDURE:ThisfunctionreadsthedatafromthehardwareusingtheEPICSMCArecord,andtheninvokesMCA:GET_DATAADDITIONALINFORMATION:SeeMCA:GET_DATA().MODIFICATIONHISTORY:Writtenby:MarkRivers,October1,1997Nov.14,1997MarkRivers.Changedroutinetoeliminatesettingrec.READbackto0,sincerecordsupportdoesthisautomaticallyanditwascausingrecordtoprocessagain.19-Sep-1998MLRAdded/WAITtocaput,sincedefaultisnottowaitforcallbacknow.17-Mar-1999MLRRemoved/WAITfromcaput,tobecompatiblewithversion4.3andlateroftheMCArecord,whichdoesnotfireforwardlinksuntilacquisitioniscomplete.28-Mar-1999MLRChangedroutinesoitnolongerpokesREADfield.Thisassumesthatsomeoneelse(typicallyadatabase)isperiodicallypokingtheREADfield.TheobjectinitializationcodenowsetsamonitorontheVALfield.AddedNew_flagoutputandCHECK_NEWkeyword.(Seeepics_mca_),24,IDLEPICSApplications,mcaDisplayFull-featuredprogramfordisplaying,controllingEPICSmulti-channelanalysers,includingpeakfittingUsesepics_mcaclasslibrary,andexportsmca_displayclass,soitcanbecontrolledbyotherIDLapplications,25,IDLEPICSApplications,Datacatcheranddataviewer(Ben-ChinCha),26,UsingEPICSfromVisualBasic,ezca.dllcanbecalleddirectlyfromVisualBasiconWindowsezca.basprovidestheinterfacePublicConstezcaByteAsByte=0PublicConstezcaStringAsByte=1PublicConstezcaShortAsByte=2PublicConstezcaLongAsByte=3PublicConstezcaFloatAsByte=4PublicConstezcaDoubleAsByte=5PublicDeclareFunctionezcaGetLibezca.dll_(ByValpvnameAsString,_ByValezcatypeAsByte,_ByValnelemAsLong,_ByRefdataAsAny)AsLongPublicDeclareFunctionezcaPutLibezca.dllAliasezcaPutOldCa_(ByValpvnameAsString,_ByValezcatypeAsByte,_ByValnelemAsLong,_ByRefdataAsAny)AsLongPublicDeclareFunctionezcaPutStringLibezca.dllAliasezcaPutOldCa_(ByValpvnameAsString,_ByValezcatypeAsByte,_ByValnelemAsLong,_ByValdataAsAny)AsLongPublicDeclareFunctionezcaPutCallbackLibezca.dllAliasezcaPut_(ByValpvnameAsString,_ByValezcatypeAsByte,_ByValnelemAsLong,_ByRefdataAsAny)AsLong,27,UsingEPICSfromVisualBasic,Example:tomographydatacollection.VBusedbecauseitcaneasilycontrolRopersWinViewprogramfortheCCDdetector,PythonApplicationsforBeamlineControl,MarkRivers,29,ReplaceIDLapplications(e.g.MCAGUI)withPythonsothatotherbeamlinesdontneedtobuyIDLSendusershomewithdataanddisplay/analysisprogramsthatarefree.TheydontwanttobuyIDL.,Motivation,30,BuildingBlocks,CaChannelfromGeoffSavageforEPICSinterfaceTkinterandPmwforGUIsPmw.BltforplotsNumericforarrays,31,BltPlot:EnhancementstothePmw.Blt.Graphwidget,Astandaloneplottingwidget,BltPlot.BltPlot.Thiswidgethasmenusto:ConfigurealloftheplotcharacteristicsSaveandrestoretheplotsettingsanddataPrinttheplottoafileorprinterMethods(BltPlot.plotandBltPlot.oplot)tocreateanewplot,tooverplotmoredata,etc.DesignedtoprovidearoughemulationofthecommandlineplottingcapabilitiesofIDL.,32,BltPlot,33,BltPlot:EnhancementstothePmw.Blt.Graphwidget,GUIroutinestoconfigurealloftheplotcharacteristics,suchasaxes,markers,legends,etc.TheseroutinesworkwithanyPmw.Blt.Graphinstancesotheycanbeusedfromthestandaloneplottingwidgetinthispackage(BltPlot.BltPlot)orfromanyapplicationthatusesthePmw.Blt.GraphwidgetRoutinestosaveandrestoreplotsettingsanddata.UsedinthemcaDisplaydescribedlater.,34,BltPlotDialogs,35,epicsPV:SubclassesGeoffSavagesCaChannelclass,IfaPVnameisgiventhentheclassconstructorwilldoasearchw()bydefault.setMonitor()setsagenericcallbackroutineforvaluechangeevents.Subsequentgetw(),getValue()orarray_get()callswillreturnthevaluefromthemostrecentcallback,andhencedonotresultinanynetworkactivityorlatency.Thiscangreatlyimproveperformance.checkMonitor()returnsaflagtoindicateifacallbackhasoccurredsincethelastcalltocheckMonitor(),getw(),getValue()orarray_get().Itcanbeusedtoincreaseefficiencyinpollingapplications.,36,epicsPV,getControl()readsthecontrol“andotherinformationfromanEPICSPVwithouthavingtousecallbacks.InadditiontothePVvalue,thiswillreturnthegraphic,controlandalarmlimits,etc.putWait()callsarray_put_callback()andwaitsforthecallbacktooccurbeforeitreturns.Thisallowsprogramstousearray_put_callback()synchronouslyandwithoutuser-writtencallbacks.,37,epicsMotor,ClasslibraryforEPICSmotorrecordMethods:move(),stop(),wait(),get_position(),set_position()Virtualattributes:slew_speed,base_speed,high_limit,low_limit,done_moving,backlash,resolution,etc.Exampleuse:fromepicsMotorimport*m=epicsMotor(13LAB:m5)m.move(10.)m.wait()m.get_position(dial=1,readback=1)9.9609375,38,epicsScaler,ClasslibraryforEPICSscalerrecordMethods:start(),stop(),read(),wait(),get_label(),set_label()Exampleuse:fromepicsScalerimport*s=epicsScaler(13LAB:scaler1)s.get_counts()s.read()0,0,0,0,0,0,0,0s.start(1.)s.wait()s.read()10000000,0,0,0,0,0,0,0,39,epicsLogger,GUIappplicationforloggingEPICSPVstothescreenandtoadiskfile,40,mcaDisplay,41,mcaDisplay(),ReplacementformyIDLMCAdisplayprogramMuchnicerinmanyrespects,sincetheBltplotwidgethasmanymoreeast-to-usefeaturesthanIDLsdirectgraphicsPythonobjectwithcallablemethods,soitcanberemotelycontrolledDeviceindependent.Itreadsfilesandcontrolsthe“hardware_mca”class.“hardware_mca”
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 临汾市大宁县2024-2025学年数学三下期末经典模拟试题含解析
- 辽宁省新宾县联考2024-2025学年初三四模英语试题试卷含答案
- 西藏省重点中学2025年中考语文试题5月冲刺题含解析
- 江西应用工程职业学院《医疗器械注册与质量管理》2023-2024学年第一学期期末试卷
- 吉林工程技术师范学院《医学昆虫学》2023-2024学年第一学期期末试卷
- 江西2025年数学三下期末达标检测模拟试题含解析
- 四川西南航空职业学院《家具展示设计》2023-2024学年第二学期期末试卷
- 昆山登云科技职业学院《冶金学术基础英语》2023-2024学年第一学期期末试卷
- 郑州旅游职业学院《通信工程专业导论》2023-2024学年第一学期期末试卷
- 开封大学《学前儿童社会活动设计与指导》2023-2024学年第二学期期末试卷
- 2025福建省泉州市房屋租赁合同范本
- 中华遗产考试题目及答案
- 全厂设施色彩、标志牌统一规定
- 物业电工安全培训
- 湖南省炎德英才名校联考联合体2024-2025学年高二下学期3月月考-化学+答案
- 腾讯财经笔试题库及答案
- 工程招标代理服务方案
- 2023年河南单招职测真题(带答案)
- 办公室环境改善项目计划书
- 肛瘘的术后护理
- 畜牧兽医创新创业
评论
0/150
提交评论