Bestand wählen
Merken

1.4 Adding Rappture to MATLAB Applications

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Beta
Erkannte Entitäten
Sprachtranskript
all of a and it was hot only in simulation and will work for new technology Boardwalk ch this last
section now we're gonna put everything altogether is a little about about rapture you learn a little bit about Matlab now I'm going to show you how to build a Matlab application that has a rapture interface that trash that so
suppose you already have a Matlab program that somebody else wrote your advisor wrote would be surprised to be and you have a diamond file tomorrow and says here's the program put up on on right so that might write it like this if I had this very that amscript I could run Matlab national displayed as your fairy and it might do all that stuff remember I showed you few minutes ago that this function to display a prompt input all that stuff so that's what this program is going to do and it's gonna ask me to enter a Fermi level and I'm gonna type in 2 . 4 is going to tell me that the temperature and type in 77 and then it's going to run and when it's all done this program produces a file called out that that that has all this data so that's that's like the program that your advisor is going to give you were where you're you're seldom workers in the next cubicle that's the program may have and what you want to do is take that program and turn it into a rapture interface if we do it in rapture it'll look like this right instead of some 19 seventies looking thing like this will have a nice graphical interface with some input controls and some curves and you be able to plot multiple cases all that and by the way this example that we're we're walking through is actually in the rapture examples directory if you look in the the middle of in the rapture of the project and then all of you can find all these different examples in fact this this very example we do it all the languages so if you wanna see with the Fermi function looks in Python and how it looks in C language and for training and in this case we're looking at the version that's all in Matlab so the true so let's walk through it if you go into that directory and you take a look at the Fermi that amscript it looks like this this is a standard kind of matlab thing it starts out with a distance function in the input function because it's got you gotta get a value in for and then the destiny input function for the because you need a value for t and then at the end of it you can see the dust and stuff in the middle and at the bottom it opens up the file and writes out of my chest often in quick right so basically the top is words getting all the input values the bottom was worth writing out all the results and in between so there's a little bit of physics that just about any program that you look at you can kind of see that way so those 1st 2 lines of that number is next 2 lines of that number and this bottom part basically is sorta like the curve that you would get in rapture sites this sort of one-to-one correspondence that whenever I look at a program like this is always funny to me because usually about half the code the program is related to the inputs and the outputs right but people spend all the time trying to come up with fancy parser is although plotting routines and all that stuff which is great if you guys like to programming but if you just want to make a tool that works you really want focus all your effort on the middle part which is where the physics as so little bit code in the middle is where the action is and you can really help raptured take care of reviews rapture to take care of the rest of the stuff that trash alright so that's what we're gonna do
suppose we go into the rapture builder and we want to do the same thing that that instead of using input and output knowledge stuff will go into rapture and will grab a number of control of the left hand side drag and drop that the input section and if you look at the number we can give a label of ambient temperature we can get a nice description for the tool a default value member of everything shove a good default value on number control in rapture is like a double precision value so I can set 297 . 5 degrees Kelvin number also has units the units of measurement right there you can set the default units to be Calvin Fahrenheit centigrade whatever rapture smart about units it knows that Calvin fahrenheit and centigrade oral temperature so it knows how to do units conversions so you can say well I prefer kelvin but my user can type in whatever they want whatever their favorite units are and so we're gonna go and make held the standard units but again any temperature units will work and you can also set min max values on that so for example you guys know you might know from physics you can go below 0 degrees Kelvin 0 degrees Kelvin is absolute 0 it's the coldest possible temperature I don't know what happens I think that whole universe like rewinds if you go lower than 0 degrees Kelvin it's not allowed so and so we can't let our users simulate lower than 0 degrees Kelvin either because the simulator undoubtedly will caught so we can set a minimum value of 0 degrees Kelvin and and rapture will enforce that if someone tries to type a negative 5 rapture stops and right up front you can also set a maximum value 500 kelvins pretty hot and it's not a million degrees kelvin which is like the sun or something but it's pretty hot and there's a good chance that above 500 kelvin my simulators gonna caught up so I wanna make sure my simulated doesn't core dump all just put in a maximum 500 kelvin there but if there is no maximum for your simulated and don't specify max it so you don't have to have a minimax value those this help you god guard against that values so I can define a temperature that way that's 1 control I can define the next 1 the next 1 is my theory energy labeling very level that's what the physicists call it it's the energy at the center of the ferry distribution if you know what the heck that is of it's all the statistical probability quantum mechanics stuff but I give a good default value 0 electron volts and units in this case the units of energy electron volts or jewels are units of energy and rapture knows about both of them so offset EV is pretty good but most people are comfortable that set you use units of measurement and again I can send minimax value I could say really does make sense to go lower than 10 by extending the or higher than 10 dB but if it does make sense than just leave those are you know this is a few other options you can set an icon and this stuff like that if you wanna mess around with it can address up your interface the try last but not least I take the curve object and drag out over under the output side and then I specify everything I know about it so what is this curve the curve than producing is the Fermi-Dirac factor it's really great to give a good description to these things because when you're user hits the program but in like what the heck is the very direct factors like I can leave you guys come on that's not how many of you actually knew what the Fermi-Dirac factor was nobody right chanoyu you targeted now it's not just that it's after lunch and you shy about raising your hand because the act of course you don't know what the very direct factors at the very esoteric concept when you build tools everything you put in your tools can be confusing to some users because they haven't spent any time learning your area the stupid they don't know anything about this right so this very thing there even physicists out there I might use a different nomenclature you know I'm a for any function and they say which 1 very direct factor of order 1 apple what's right so you gotta be specific about this stuff so that people can understand what you're stimulating and what it means so you should always have some some pretty good descriptions of the goes along with all your all your people parts also we can specify the axes the X axis is going to be the Fermi function actually in the y axis here is energy as a little weird compared to most your x y plots but that's lamplighter here on the kind of tilted the way you might think about otherwise and you can specify descriptions of everything for the x and the y axis and you know it's units you know as my Y axis has units of electronvolts thing specify units all that so that all those to the plot try now on the
tools side there few more things to set remember the builder we always have the title and some description and then the language octave somebody's opted for this example right now
let's take a look remember when I say that of the builder is can automatically generate my skeleton file my mean diameter right if I take a look at the main died that got generated what I really wanna where says and your code here for the main by your program I wanna go back to that script I showed at the beginning I wanna take that chunk of code and stick it in there that's relevant so there is my chunk of physics code that's what I want to stick in the middle there and if you look at that physics code it's using variables called on and T. those are my inputs so if i'm clever about naming things they're figuring out how to get hooked up when I created the core control inside my fracture builder I call the temperature so temperature is is the same as what I was calling to in my other script f to kind of figure that out you know the variable that I'm calling in the builder versus what I'm calling in my code and make sure those are matched up and similarly on the output side my program produces vectors The N and down here the builder was calling X and Y so I don't match that of somehow got a set X equals B and y equals after I got a substitute enough in there or something that match that up to make it fit so if I take that code and stick it in the middle of my skeleton program and if I change of variable names to match 1 place to the other to make it all match up that everything all work so this is a way of doing it here I basically stuck the codon and I renamed to the T temperature and the 2nd half and on the x y data and everything else that fits everything else the work that to so now you remember how this works i've got a tool that XML and what I run rapture rapture reads the tool that XML and in this case creates the 2 inputs the temperature and the Fermi level and when I click on simulate it produces the driver files driver files copy of tool that XML but has the current values it runs my code which has the physics in there and then produces a run file on the run file has occurred in it and you can see all the x y values in the curve that's the data that I generate generated so that's how it works right that and then it plots then was that filed away and stores it in your results directly during the trash part
1 last thing I'll tell you before we get you go on your next lab assignment on the on every once in a while Matlab when it goes wrong because it does weird things on this goes wrong inside a script you might see it looking like hanging here and kind of freeze and you'll see something weird like the back shape and the greater the greater than or something weird like that but usually what happens Matlab at this point here there and is now waiting goes in the interactive mode is waiting for you to type something in raptures waiting for Matlab to finish and that I was waiting for you to type something right so you can get stuck in a deadlock so if you see something like this in running and it seems like it's taking forever it's like looks weird it could be that Matlab is kind of broken and waiting in this deadlock but I think activist slightly better behaved the other thing about Matlab is that sometimes it does weird things to terminal when this happens and then you go back to your X Germany tried type nothing types anymore your terminal that does screw things your terminal and so anyway be forewarned and if you see something weird like that you can click board and it may or may not give you some error information but anyway at that point you're going to have a driver file you can get in the matlab you can go through and run everything by hand like we're talking about earlier right so when you encounter an error which are likely to in Matlab script then you need to get in and try to run with the driver file by hand figure out what's wrong if you can get to run properly with the driver file just like this morning free then you go back to rapture and try every should work fine if you wanna run by hand we have a driver file so and make sure you say use rapture make sure you got use matlab reuse octave and then you can type in something like this you can type matlab that dashed are setting the variable in file equal to the driver file Common main this is sorta like the way Russia would run it if you looked inside the tool that XML or you can fire up matlab you can set the variable in file equals to the name of the driver file and indeed is run by and either way but what we're trying to do is we're trying to set the file equal to the driver file and then we're trying to run the script and so if you need to debug that's how you do it in an inactive you do something similar say octave and UNICEF in file to the driver files and can come from there that in file thing that I'm telling you about
if you look back in your script in this script near the top of his main that you'll see that it's looking for a variable called in file that's the name of the driver file so there's no magic you can look in the skeleton file and see that by so here is your next
lab assignment you guys are experts know inspire graph theory so you have the code for the spiral graph what we wanna do is we want to build a rapture interface for spiral graphs and this spiral graph is going to take 3 numbers and 1 and 2 and 3 use numbers not integers because you might want to take in a value like 13 point 2 in this case and it's actually allowed you can type in any real number but doesn't have to be an integer so you 3 numbers and then those of you in 1 and 2 and 3 and then at the end you're going to produce a curve for the alpha right so your 1st step is to get into the builder to put in 3 numbers and an output curve disabled is a tool that XML generate your main skeleton script and then you're going to go back to the cell is that when you're gonna state this code right in the middle of the cell script and if you do everything right it'll work like a dream to
private let me show you the solution now that I have for this assignment number 4 and we want to build a tool in rapture that takes this Matlab Octave code that were showing here and we want to build it into a tool with fracture where you can have a user specified inputs and generate the curves so folks
from show yeah here we are in the workspace and I can start up active and I can run my spiral graph script and it pops up a little plot and and I use these values for a and 1 and 2 and 3 if we look at the script again no big magic understanding and 1 and 2 and 3 and then using the 3 lines of code that I showed you for the lab exercise to do
the plot so the trick now is to take that script and convert it into a rapture tool so I'm going to make a directory on the x 4 and see that directory and then and the run the builder rapture dash builder and for this
particular tool it takes 3 numbers Simon drag the number control over 3 times for the 3 different numbers so takes the 3 numbers and 1 and 2 and 3 and then I'm going to produce a curve as the output result right so those are the things I need in rapture and I just checked fix up all the controls under renamed this number N 1 because that's the variable i wanna call in the Programme effect and even the label it 1 and I'll I'll call it 1st coefficient and I'll give a default value for example of 13 now go to the next number and all remaining at 2 n 2 and that the label on the screen also do and 2 I'll call it 2nd coefficient and see all of these guys OK and then later 6 and the 3rd element label and 3 colored 3 on the screen in that number and 3 that's the 3rd coefficient and given a default value of 0 6 I guess or something and then on the output side of call this 1 z and given label spiral graphs and Canada description for the axis label or call it real of z and if I scroll down there's also a Y axis label for image's z analysis take a look at the preview Previous says not dangers 5 warnings for the current tool definition examined resolve yes and what we through and show me everything I forgot or I should say that it's telling you should have a title for this tool so a call it's paragraph tool and I say next it tells me I description for the tool to yeah solution for OK for labs number 4 and then next and that tells me I have to choose the program but this is sort of a Matlab thing underneath the active and the new free clone of matlab instead alright so I fix those things a preview they're still 2 more
warning stop and I think they're just axis label warnings
yes it's bugging me about the x-axis description about the y axis description really I should fill those in and but I'll just flip to preview and ignore them
and looks pretty good overall so I'm gonna go and say this now given that the 2 warnings that's OK I'll say the tool that XML and also the skeleton program that I want generate an octave no need for a Makefile with active sources those 2 files from the builder now you can see I've got the 2
files now the trick is I go into the main program may not and this is generated by the rapture builder and I have these 3 numbers N 1 N 2 and N 3 and also up there and it says add your code here for the main body of the program so I'm going to go ahead and add that coding and from my previous scripts or get rid of these progress statements my program will take longer run and the loading and that Spiro . script that we're running just a minute ago right so that's the script that script had N 1 N 2 and N 3 hard-coded but now I'm going to get N 1 and N 2
and N 3 from rapture so I don't need those 3
statements of this delete those and fortunately I was smart enough to call my my rapture inputs and 1 and 2 and 3 so we're all we're all set to go there my script also had a plot statement and I don't need that and instead of a plot statement I'm going to do the
output thing in in rapture and you can see here there's this variable x y data composed of X and Y so really I just need to define what X and Y is minus x equals real of z and y equals the manager of z and then now I don't need the plot statement and everything connects up so that's pretty good now I've I've got my output here that's all connected up actually if I
didn't want those extra variables X and Y I could also just do this I could just say real of z like that and the manager of z like that I could plug those in right directly in place of X and Y and now I don't need those 2 vectors full shorter that way right so I've I've got my team i z that's basically the meet my program and then the z vector is being converted
into the real part and imaginary part which goes into the output curve but I wanna generate some that now and now if I run it in rapture will bring up the interface that I just created a lesson default values and I can click simulate and generate a case I can try something different minus 7 and simulate will generate another case and I can try to an 18 and minus 3 and set those values and simulate and I get yet another case so now I can use rapture to call my my program with all these different values getting kind interesting shapes along the way so now anyone can run my script and they can plug in lots of different values for spiral graph
Kollaboration <Informatik>
Bit
Kartesische Koordinaten
Garbentheorie
Simulation
Computeranimation
Schnittstelle
Distributionstheorie
Umsetzung <Informatik>
Bit
Physiker
Extrempunkt
Formale Sprache
Versionsverwaltung
Kartesische Koordinaten
Computeranimation
Richtung
Übergang
Deskriptive Statistik
Einheit <Mathematik>
Minimum
Tropfen
Kurvenanpassung
Default
Bijektion
Gerade
Schnittstelle
Funktion <Mathematik>
Statistik
Güte der Anpassung
Plot <Graphische Darstellung>
Bildschirmsymbol
Ein-Ausgabe
Teilbarkeit
Konfiguration <Informatik>
Dirac-Gleichung
Rhombus <Mathematik>
Funktion <Mathematik>
Menge
Einheit <Mathematik>
Rechter Winkel
Ein-Ausgabe
Garbentheorie
Benutzerführung
Projektive Ebene
Ordnung <Mathematik>
Verzeichnisdienst
Standardabweichung
Schnittstelle
Web Site
Subtraktion
Wellenpaket
Hecke-Operator
Teraelektronenvoltbereich
Oktave <Mathematik>
Gruppenoperation
Physikalismus
Zahlenbereich
Gebäude <Mathematik>
Quantenmechanik
Code
Physikalische Theorie
Datensichtgerät
Unendlichkeit
Diskrete Simulation
Datentyp
Koroutine
Delisches Problem
Abstand
Gravitationsgesetz
Optimierung
Gigaelektronenvoltbereich
Grundraum
Hilfesystem
Gammafunktion
Elektronische Publikation
Parser
Fokalpunkt
Quick-Sort
Chipkarte
Objekt <Kategorie>
Energiedichte
System F
Minimalgrad
Flächeninhalt
Mereologie
Energiedichte
Gamecontroller
Wort <Informatik>
Speicherabzug
Luftreibung
Term
Resultante
Oktave <Mathematik>
Formale Sprache
Physikalismus
Gebäude <Mathematik>
Information
Code
Computeranimation
Übergang
Deskriptive Statistik
Skeleton <Programmierung>
Variable
Code
Theoretische Physik
Skript <Programm>
Substitution
Kurvenanpassung
Optimierung
Speicher <Informatik>
Figurierte Zahl
Funktion <Mathematik>
Durchmesser
Dreizehn
Plot <Graphische Darstellung>
Vektorraum
Ein-Ausgabe
Elektronische Publikation
Arithmetisches Mittel
Druckertreiber
Menge
Rechter Winkel
Mereologie
Oktave <Mathematik>
Gamecontroller
Speicherabzug
ATM
Verklemmung
Shape <Informatik>
Punkt
Gefrieren
Elektronische Publikation
Whiteboard
Computeranimation
Skeleton <Programmierung>
Druckertreiber
Code
ATM
Datentyp
Radikal <Mathematik>
Oktave <Mathematik>
Skript <Programm>
Skript <Programm>
Addition
Information
Figurierte Zahl
Fehlermeldung
Expertensystem
Punkt
Graph
Oktave <Mathematik>
TLA <Logik>
Zahlenbereich
Zellularer Automat
Gebäude <Mathematik>
Ungerichteter Graph
E-Funktion
Code
Computeranimation
Skeleton <Programmierung>
Reelle Zahl
Ganze Zahl
Rechter Winkel
Spirale
Datentyp
Jensen-Maß
Skript <Programm>
Graphentheorie
Kurvenanpassung
Gleichungssystem
Funktion <Mathematik>
Schnittstelle
Aggregatzustand
Explosion <Stochastik>
Krümmung
Graph
Spieltheorie
Mathematisierung
Plot <Graphische Darstellung>
Gebäude <Mathematik>
Smith-Diagramm
Baumechanik
Information
Code
Computeranimation
Einheit <Mathematik>
Code
Spirale
Schlussfolgern
Skript <Programm>
Verzeichnisdienst
Gerade
Kartesische Koordinaten
Programmiergerät
Freeware
Zahlenbereich
Gebäude <Mathematik>
Kartesische Koordinaten
Element <Mathematik>
Ungerichteter Graph
Computeranimation
Deskriptive Statistik
Spirale
Optimierung
Kurvenanpassung
Drei
Default
Bildgebendes Verfahren
Funktion <Mathematik>
Touchscreen
Analysis
Soundverarbeitung
Systemaufruf
Strömungsrichtung
Quick-Sort
Koeffizient
Gamecontroller
Resolvente
Klon <Mathematik>
Deskriptive Statistik
Skeleton <Programmierung>
Cookie <Internet>
Oktave <Mathematik>
Gebäude <Mathematik>
Kartesische Koordinaten
Quellcode
Elektronische Publikation
Computeranimation
Befehl <Informatik>
Arithmetische Folge
Einheit <Mathematik>
Ein-Ausgabe
Skript <Programm>
Zahlenbereich
Plot <Graphische Darstellung>
Ikosaeder
Gebäude <Mathematik>
Optimierung
Elektronische Publikation
Variable
Code
Computeranimation
Befehl <Informatik>
Vektorraum
Plot <Graphische Darstellung>
Gebäude <Mathematik>
Extrempunkt
Ein-Ausgabe
Computeranimation
Metropolitan area network
Datenmanagement
Funktion <Mathematik>
Ein-Ausgabe
Skript <Programm>
Hacker
Funktion <Mathematik>
Shape <Informatik>
Subtraktion
Graph
Gebäude <Mathematik>
Vektorraum
Information
Extrempunkt
Computeranimation
Komplexe Ebene
Variable
Datenmanagement
Funktion <Mathematik>
Einheit <Mathematik>
Spirale
Diskrete Simulation
Primzahlzwillinge
Ein-Ausgabe
Skript <Programm>
Optimierung
Kurvenanpassung
Default
Hacker
Normalvektor
Schnittstelle
Funktion <Mathematik>

Metadaten

Formale Metadaten

Titel 1.4 Adding Rappture to MATLAB Applications
Serientitel Rappture Bootcamp
Teil 1.4
Anzahl der Teile 12
Autor McLennan, Michael
Lizenz CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
DOI 10.5446/18188
Herausgeber nanoHUB
Erscheinungsjahr 2012
Sprache Englisch

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract 00:09 Adding Rappture to MATLAB Applications 00:24 Example: Matlab/Octave Tool 02:06 What is the interface? 03:31 Build the interface: Temperature input 05:42 Build the interface: Ef input 06:29 Build the interface: Curve output 08:07 Build the interface: Use MATLAB/Octave 08:20 Add physics to the generated code 09:54 Add physics to the generated code 10:09 Running the code 10:55 Debugging 13:38 Assignment #4: Build a simple Spirograph tool

Ähnliche Filme

Loading...
Feedback