已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026文化融合面试题及答案
- 不孕不育人群肥胖症诊疗指南2026
- 2026届综合能力综合测评QS01黑白可打印精练卷:真题精练与答案解析·机械设计基础第七版杨可桢课后习题专题(含参考答案、逐题解析与学生作答区)第009套
- 北京市垃圾卫生填埋场生产安全事故隐患目录(2022年度)
- 办公用品采购需求审批通知函6篇
- 新增采购物资验收流程通知函4篇范文
- 2026届苏州市七年级数学期末质量检测QS01黑白可打印原创仿真卷B1第042套(含答案详解与评分标准)
- 麦饭石矿泉水瓶装线设备改造项目可行性研究报告模板-申批备案
- 2026年金华市金东区社区工作者招聘考试备考试题及答案详解
- 2026年秦皇岛市海港区事业编单位人员招聘考试备考题库及答案详解
- 龙岗区2024广东深圳市龙岗区水务局招聘聘员2人笔试历年参考题库典型考点附带答案详解(3卷合一)
- 郭艳民摄影构图课件
- 课程论文写作要求及评分标准
- 用人单位劳动防护用品管理规范
- 高速公路改扩建工程施工方案
- 医疗器械委托研发协议
- GB/T 4772.1-2025旋转电机尺寸和输出功率等级第1部分:机座号56~400和凸缘号55~1 080
- 委托洗衣液生产合同范本
- 船舶维修项目管理实施方案
- 社区矫正实务课件
- 2024-2025学年吉林省长春市绿园区北师大版三年级下册期末测试数学试卷(含答案)
评论
0/150
提交评论