ui framework for distributed fitting service

25
UI Framework for Distributed Fitting Service Paul Kienzle Wenwu Chen, Ziwen Fu Reflectometry Group, NIST

Upload: aysha

Post on 05-Feb-2016

35 views

Category:

Documents


0 download

DESCRIPTION

UI Framework for Distributed Fitting Service. Paul Kienzle Wenwu Chen, Ziwen Fu Reflectometry Group, NIST. View Developer (UI). Reduce Service Developer (Reduce). Service. Service. Service. Service. Scientist (Application). Data simulation. Theory Developer (Map). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: UI Framework for Distributed Fitting Service

UI Framework for Distributed Fitting Service

Paul KienzleWenwu Chen, Ziwen Fu

Reflectometry Group,NIST

Page 2: UI Framework for Distributed Fitting Service

Software Infrastructure of PARK: the distributed fitting service

Job Server

ServiceService

ServiceService

Working Nodes

User Interface

Scientist (Application)

View Developer (UI)Reduce Service Developer (Reduce)

Data reduction

Theory Developer (Map)

Data simulation

Data presentation

Model buildingData View

Page 3: UI Framework for Distributed Fitting Service

Distributed Computing Environmentloose coupled server/client pattern (map/reduce)

Service ServerMaster Node

User

Cluster

Working Nodes

User/Client

ServiceServerManagement

WorkingServer

User User User User

Page 4: UI Framework for Distributed Fitting Service

UI Overview

• High Level– Job Work flow– Job History, Redo, Undo– ……

• Low level (UI/GUI*)– Model building (dataset, reduction, model)– Job request– Viewer of Job reply

Page 5: UI Framework for Distributed Fitting Service

Data Structure & UI for Fitting(1)

FittingConstrain

Page 6: UI Framework for Distributed Fitting Service

Data Structure & UI for Fitting(2)

FittingModelBuilder

FittingDatasetViewer/EditorFittingResultsViewer

Page 7: UI Framework for Distributed Fitting Service

Developed GUI for Fitting Service

• TraitsUI– Easy for simple applications– Less-controllable of the widgets– Compatible, complexity, speed

• wx AUI + matplotlib– Dataset orientated (works now, version 0.3)– Job orientated (in developing, version 0.4)– wx.plot now, changed to matplotlib later

• Future?

Page 8: UI Framework for Distributed Fitting Service

GUI Framework

FittingConstrain

FittingModelBuilderFittingDatasetViewer

FittingDatasetEditor

FittingModelPage

Dataset event

Dataset event

Model event

Model event Model events:1. The whole model is updated2. The parameter value is changed

FittingViewer

Network event

Page 9: UI Framework for Distributed Fitting Service

Models

• Dataset UI

– DatasetViewer : FittingDatasetViewer– DatasetEditor : FittingDatasetEditor– DatasetMetadataViewer : FittingDatasetMetaViewer

Data Structure– Dataset : XmlDataset (data reduction)– Data : XmlData (read/write data)– MetaData : XmlMetaData (read/write data)– Parameter : XmlParameter (parameters for model)

Page 10: UI Framework for Distributed Fitting Service

Models

• ModelBuilder UI

– ModelPage : FittingModelPage– ModelBuilder : FittingModelBuilder– ModelResultViewer: FittingViewer (optional)– ModelParameterViewer:

FittingParameterViewer (optional)

Theory– ModelTheory: Theory

Available Models: Gaussian Fitting, Reflectometry for NCNR and SNS~/park/parkClient/builder/gauss, NCNRRefl, refl

Page 11: UI Framework for Distributed Fitting Service

Examples: Gaussian Fitting

• Theory (Theory developer)– GaussTheory

• Data structure (Theory & UI developer)– GaussXmlDataset, GaussXmlData– GaussParameter

• Dataset (UI developer)– GaussDatasetViewer, GaussDatasetEditor– GaussDatasetMeta, GaussDatasetPanel

• Model Builder (UI developer)– GaussModelPage, GaussModelBuilder

Page 12: UI Framework for Distributed Fitting Service

Examples: SNS Refl Fitting

• Theory – ReflTheory*

• Data structure – ReflSNSDataset, ReflSNSData– ReflParameter*

• Dataset – reflDatasetViewer, reflDatasetEditor– reflDatasetMeta, reflDatasetPanel

• Model Builder – ReflModelPage, ReflModelBuilder

Page 13: UI Framework for Distributed Fitting Service

Examples: NCNR Refl Fitting

• Theory – ReflTheory*

• Data structure – NCNRDataset, NCNRData– ReflParameter*

• Dataset – NCNRDatasetViewer, NCNRDatasetEditor– NCNRDatasetMeta, NCNRDatasetPanel

• Model Builder – ReflModelPage, ReflModelBuilder

Shared with SNS Refl Fitting

Page 14: UI Framework for Distributed Fitting Service

Download PARK

Source code:

svn co svn://[email protected]/park

Windows executable files:

http://chemnuc-20.umd.edu/~DANSE/ download/index.html

Page 15: UI Framework for Distributed Fitting Service

Data Structure & UI for Fitting(1)

XmlMultiplexor

Page 16: UI Framework for Distributed Fitting Service

Data Structure & UI for Fitting(2)

Page 17: UI Framework for Distributed Fitting Service

Fitting• doFitting()

– Return the object representing the fitting results• getOptimizer()

– Return a real optimizer object• getXmlOptimizer()

– return the object that is the xml representation of the optimizer• setXmlOptimizer(optimizer)

– set the object that is the xml representation of the optimizer• getXmlMultiplexor()

– get the object that is the xml representation of the multiplexor• setXmlMultiplexor(xor)

– set the object that is the xml representation of the multiplexor

Page 18: UI Framework for Distributed Fitting Service

XmlMultiplexor

• getVariables() – Return a list of variable definitions– Variable attributes:

• Name: read only, model_name.parameter_name.attribute_name• Flag: ‘optimized’ | ‘fixed’ | ‘constrains’• Value: initial value• Range: [value0, value1]

• getConstrains()– Return a list of variable constrains– Constrain attributes:

• Target: model_name.parameter_name.attribute_name• Constrain expression: string representation of constrain• evaluate(): evaluate and set the parameter’s value

• getModels() – Return a list of models

Page 19: UI Framework for Distributed Fitting Service

Model

• getDataSet()– Return the data set object representing the experimental

data and meta data

• getWeight() / setWeight(weight)– Get/set the weight

• getTheory() / setTheoryName(string name)– Return /set the theory object to calculate the theoretical

data.

• getParameters() / addParameter()– Return the parameters representing the model

Page 20: UI Framework for Distributed Fitting Service

Dataset• addData(data)

– Add a data• removeData(data)

– Remove a data• getData()

– Return a list of data• getReductionData()

– Return the joined experimental data in order of (x, y, dy)*– x, y, dy are data objects

• setTheoryData(data)– Set the theoretical data associated with the dataset

• getTheoryData()– Return the theory data associated with the dataset

• getDataSourceType()– Return the data source type

• setDataSourceType(dstype)– Set the data source type

– XML format for dataset<dataset>

<data> … </data>* <reduction> [<array> array_data </array> <matrix> </matrix> <narray> </narray>]* reduction_data</reduction> <theory> [<array> array_data </array> <matrix> </matrix> <narray> </narray>]* theory_data </theory>

</dataset>

Page 21: UI Framework for Distributed Fitting Service

Data• getReductionData() / getRawData()

– Return the reduction/raw data in order of(x, y, dy)*

• getMetaData()– Return the meta data associated with this data

• getDataSourceType()– Return the data source type

• setDataSourceType(dstype)– Set the data source type

• _readData ()– Read the data from the data source

• _writeData ()– Write the data to the data source

DataSourceType:– ‘Local’, ‘Imbed’, ‘Reply’, ‘URL’, ‘USER’

MetaData / Parametermetadata.para_name = para_valueparameter.attr_name = attr_value

Page 22: UI Framework for Distributed Fitting Service

Theory• getDataset() / setDataset(dataset)

– Return the dataset / set the dataset object• getParameters()

– Return a list of parameters• getTheoryData()

– Return the theoretical data object• getObjectiveFx()

– Return the objective function for optimizer• has1stDerivate / has2ndDerivate (parameter_name) /

– Return the true if the given parameter has the 1st or 2nd derivative

Optimizer

optimizer.para_name = para_value

Optimize()do the optimization

Page 23: UI Framework for Distributed Fitting Service

<fitting> <multiplexor> <model modelType="gauss" name="M0“

theory="gaussTheory.GaussTheory" weight="1.0"> <dataset classname="gaussXmlDataSource.GaussXmlDataset" srctype="local"> <data classname="gaussXmlDataSource.GaussXmlData“ file="C:\ gauss\gauss1.dat" srctype="local"> <gauss scale="0.500000015926"/> </data>

<data classname="gaussXmlDataSource.GaussXmlData" file="C:\gauss\gauss1.dat" srctype="local"> <gauss scale="0.500000015926"/> </data> </dataset> <param a0="39.0" name="g0" sigma="1.0" x0="0.0"/> </model> <optimizer classname=‘scipy.sciopt‘ funcname=‘fmin’

xtol='1e-005' ftol='1e-005' maxiter='1000'/> </multiplexor></fitting>

Page 24: UI Framework for Distributed Fitting Service

<fitting> <multiplexor> <model name='M0' theory=‘reflTheory' weight='1.0'>

<dataset classname=‘NCNRReflDataset.NCNRDataset' name='Dataset1' srctype='local'>

<data srctype='local' classname='shannonDataset.ShannonData' file='C:\Documents and Settings\UMCP\park-0.3.8\du53.dat'>

<NCNR wavelength='14.85' scale='1.0' divergence='10' offset2='2.0'

offset='2.0' wavelengthdivergence='0.021' angulardivergence='0.007' background='1e-010'/>

</data> </dataset> <profile> … </profile></model><constrains></constrains><variables></variables></multiplexor><optimizer classname='boxmin' xtol='1e-005' ftol='1e-005' maxiter='1000'/></fitting>

Page 25: UI Framework for Distributed Fitting Service

<profile script='profile.py'>from parseReflModelNb import *M1 = ReflModel("M1", file="inline", magnetic=False)M1.incident('Air', phi=0)M1.interface(8)M1.layer('dPS', depth=[80,90], rho=[5, 6, 9], mu=0)M1.interface(5)M1.layer('P2VP', depth=[10, 30], rho=[1, 1.8, 3], mu=0)M1.interface(5)M1.layer('SiOx', depth=[14, 20.4], rho=3.80, mu=0)M1.interface(5)M1.substrate('Si', rho=2.07, mu=0 )fit = ParkFit([M1])

</profile>