


下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
IntroductoryPythonTutorials
Inthislabsessionyouwillrunandmodifyexamplesinthe“examples_PythonTutorial”directory(whichisasubdirectoryoftheCompuCell3Dinstallationfolder).Beforeproceedingpleasecopyentire“examples_PythonTutorial”directorytoanotherlocation,sothatifyoumessuporiginalfilesyouwillbeabletorestorethemeasily.
Formostpartofthistutorialyouwillbemodifyingcellsort_2D_steppables.pyfilewhereallthesteppablesaredefined.
Exercise1
Runcellsort_2D.xmltogetherwithcellsort_2D_info_printer.pyandobservetheoutputontheconsole.
ModifyInfoPrinterSteppableincellsort_2D_steppables.pytooutputasurfaceofthecell.Whatdoyouobserve.Why?Whatisnecessarytogetcorrectvaluesofthecellsurface?
Now,outputvaluesofthecenterofmassofeachcell(cell.xCM,cell.yCM,cell.zCM).Whatarethevaluesofthisquantity?Whatdoyouneedtodoinordertogettruecenterofmass?
Finally,tocheckwhatothercellattributesofacellareaccessiblefromPythoninsertthefollowinglineinsidetheloopthatiteratesoverallthecellsinthesimulation
print“CellAttributes”,dir(cell)
Howwouldyoumodifythesteppablesothatdir(cell)informationisprintedforonlyonecell,notallofthem?
Exercise2
Runcellsort_2D.xmltogetherwithcellsort_2D_extra_attrib.pyandobservetheoutputontheconsole.
IntheExtraAttributeCellsortsteppablemodifythelinewhereyouassignattributestothelist.Insteadof
pyAttrib[0:2]=[cell.id*mcs,cell.id*(mcs-1)]
computeandstoreinpyAttribratioandaverage“radius”ofacellcalculatedusingperimeterandsurfaceareaofthecell.Whatvaluesofthethreequantitiesshouldyougetifthecellswereperfectcircles(VissurfaceareaintheiscaseandSisaperimieter)?WhatdoyouobserveforCompuCell3Dcells?Aretheyperfectcircles?
Exercise3
Insteadofusinglistasadditionalcellattribute,usedictionaryandrepeatexercise2.Youwillneedtochangetheline
pyAttributeAdder,listAdder=CompuCellSetup.attachListToCells(sim)
inthecellsort_2D_extra_attrib.pyto:
pyAttributeAdder,dictAdder=CompuCellSetup.attachDictionaryToCells(sim)
thenmodifyExtraAttributeCellsorttoworkwithdictionaryinsteadoflist.
Whenyouattachedadictionarytocellsthefollowinglinewillreturnadictionary,i.epyAttribwillbeadictionaryinthiscase.
pyAttrib=CompuCell.getPyAttrib(cell)
Forclarityyoumaychangethislinetosomethinglikethat:
cellDictionary=CompuCell.getPyAttrib(cell)
Now,insertintothedictionaryquantitiesyoucalculatedintExersice3andprintthemout.Doyouknowhowtoprintthecontentoftheentiredictionarywithoutknowingwhatthekeysare?Searchforthesolutiononline.Whatiseasiertouselistsordictionaries?
Exercise4
Runcellsort_2D.xmltogetherwithcellsort_2D_extra_attrib.pyandobservertheoutputinthePlayer.Haveyounoticedanythinginteresting?
ModifyTypeSwitcherSteppablesteppablesothatitchangestypesinthefollowingmanner:
Every100MCSallthecelltypesarechangedto1
Every200MCSallthecelltypesarechangedto2
Every300MCSallthecelltypesarechangedtoarandommixoftypes1and2
NowchangeTypeSwitcherSteppablesteppableinsuchawaythatevery100MCSallthecelltypesarechangedtoarandommixoftypes1,2and3.Whathappens?Why?
Exercise5
Runcellsort_2D_neighbor_tracker.xmltogetherwithcellsort_2D_neighbor_tracker.pyandobservetheoutputontheconsole.
Usetheskillsthatyouhavelearnedinexercises2and3tostorecellneighborsineitherlistordictionary.
Makesureyouerasethecontentoflistordictionarybeforeyoustorenewlistofneighbors.Whydoyouneedtodothis?
ThereminderofthePythontutorialsisalittlebitmoreadvancedbecauseyouwillwriteyourownPythonscriptsinsteadofjustmodifyingexistingones.Ofcourseyouarefreetocopyexistingscriptsinsteadstartingfromscratch.
Exercise6
WritecellsortingsimulationinPythonentirely(youmaygrabitfromexamplesavailableintheCompuCell3Ddirectory).WriteaPythonsteppablethatinitializescelltypesinthefollowingway
cellsatthebottomhalfoftheblobareCondensingandcellsintheupperhalfoftheblobareNon-Condensing
Maketheabovedivisionflexible–i.e.introducenewmemberparameterofthesteppablethatdescribeswherethe"cell-typedividing"lineshouldbeplaced.
Divideblobintoquartersandinitializeoppositequarterswithsamecelltype.
Exercise7
Forthecell-sortsimulationinexercise6developasteppablethatstorescenterofmasspositionsofeverycellinthesimulationevery100MCS.Writeanewfileforevery100MCS.Makesuretoincludecellidandcelltypeinthefile.
Pickfewcellsfromthesimulation.Foreachcellyoupickedrecordcenterofmasspositionsinaseparatefile,every100MCS.
Forexample,forcellwithcell.id12openupfilecell_12.txtthatwouldlookasfollows
100 23.5 32.1 0.0
200 24.3 31.3 0.0
300 25.1 33.1 0.0
…
Plotacelltrajectoryinyourfavoritegraphingprogram(Excel,Gnuplotetc…)
Howwouldyoudopartb),i.e.plottrajectoryofselectcells,usingCompuCell3D,PlayerandPython?Hint.IntroduceextrascalarfieldinPlayerfromPythonlevel.
ThisexerciseshowshowyoucandoanalysisofsimulationdatausingPython.Playerbydefaultoutputsscreenshotsonlyandthisisnotsufficientforanyrigorousdataanalysis.UsingPythonyoucandevelopyouowntoolstorigorouslyanalyzeyoursimulation.
Exercise8
Runcell-sortsimulationandfigureoutwhencellsaremoreorlesssorted.Recordthetimeandcallit.Now,developsteppablethatatswitchescontactenergiessothatcellsproducechecker-boardpattern.Recordthetimewhencellsproducecheckerboardpattern,callit.Knowinghowlongittakesforcellstosort-outandhowlongittakesforcellstoproducecheckerboa
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 房地產(chǎn)行業(yè)工作計(jì)劃制定
- 游戲活動(dòng)對(duì)幼兒發(fā)展的影響計(jì)劃
- 品牌重塑中的領(lǐng)導(dǎo)力作用計(jì)劃
- 2025年紡粘法非織造布生產(chǎn)線項(xiàng)目建議書
- 分析企業(yè)強(qiáng)弱勢(shì)的管理方式計(jì)劃
- 智研咨詢發(fā)布-2025年中國(guó)玄武巖纖維行業(yè)現(xiàn)狀、發(fā)展環(huán)境及投資前景分析報(bào)告
- 2025年高精度帶材軋機(jī)項(xiàng)目合作計(jì)劃書
- 古氣候變遷在沉積記錄中的體現(xiàn)方式
- 2025年數(shù)控超精密磨床項(xiàng)目建議書
- 地球的故事之環(huán)境保護(hù)讀后感
- DB43T 744-2012 錳水質(zhì)在線自動(dòng)分析儀
- 呼吸科護(hù)理管理制度
- TCI 331-2024 工業(yè)污染源產(chǎn)排污核算系數(shù)制定通則
- 浙江省(面試)公務(wù)員考試試題及答案指導(dǎo)(2025年)
- 《數(shù)學(xué)課程標(biāo)準(zhǔn)》義務(wù)教育2022年修訂版(原版)
- 設(shè)備拆裝施工方案
- 注冊(cè)安全工程師《安全生產(chǎn)管理知識(shí)》科目知識(shí)要點(diǎn)
- 研學(xué)旅行基地評(píng)估認(rèn)定評(píng)分表
- 《新時(shí)代公民道德建設(shè)實(shí)施綱要》、《新時(shí)代愛(ài)國(guó)主義教育實(shí)施綱要》知識(shí)競(jìng)賽試題庫(kù)55題(含答案)
- 小學(xué)百科知識(shí)競(jìng)賽題庫(kù)200道及答案(完整版)
- JJ∕G(交通) 201-2024公路橋梁支座壓剪試驗(yàn)機(jī)
評(píng)論
0/150
提交評(píng)論