## Sasmodels Enhancement Discussion Agenda

- From Roadmap
- reparametrization of models -
- What types: simple (e.g. sld → solvent fractions), complex (e.g. molecular constraints), other?
- How to implement (using categories, on the fly change, constrained fit special workflows, other?)
- Resources - when?

- Inclusion of more complex structure factors
- Locally Monodisperse approximation, others
- Structure factors that include the form factor directly
- How/who? resources?

- scatter 2D modeling of crystal structures
- Stephan Forster Scatter -http://www.esrf.eu/UsersAndScience/Experiments/CRG/BM26/SaxsWaxs/DataAnalysis/Scatter
- How/who?

- 1D oriented data (i.e. 1D cuts through anisotropic data)
- Do we bother?
- How: separate function in model file (e.g. Iqxy1D), calculate in 2D and slice (e.g. use existing models and add infrastructure), other?
- How/who?

- reparametrization of models -
- New item
- Computational speeds - exploring integration options
- Options (golden vectors, adaptive, other?, combos?)
- Precision with single precision and compatibility with openCL
- Do we punt again? who/how resources?

- Optimizer benchmarking
- Project description
- Use cases covering broad base of different
**types**of problems

- Computational speeds - exploring integration options

## Minutes

### Reparameterisation of models

- Use Cases:
- Amounts of water in outer layer vs SLD of layer
- Number of particles / packing e.g. Volumes of heads and tails tied
- Examples of complicated things from Sylvain and Richard e.g. micelles with charge and molecular constraints

- How to implement?
- Make lots of models and use categories to manage. Each parameterization of a model is now its own model
- Provide a "workflow" that uses the contraints system to create on the fly
- Create new infrastructure to add calculated parameters on the fly

- How do we do this?
- Can we make a good interface for the user to do parameter mapping
- Wojciech - the optimiser might have problems with that if we are not careful.

- RKH: Would need non-fittable (static) parameters
- PDB: this is also been needed with constraints
- AJJ: Also been needed in calculated outputs
- "There is a ticket for that"
- Also other static output plots (see SLD profiles, see 3D shape) would be nice .. though off-topic here.

- Narayan: Make sure that all constrained parameters (fitable or not) are visible and that it is clear that they are constrained.
- PDB: Actually should be easy to provide an on the fly reparameterization: Use a GUI tool like the Add Model Editor to provide parameters, any constraints and their relationship to the existing parameters. Then "create the code" by editing the model file: adding the conversion math at the beginning of the function. Essentially the infrastructure and a first order proof of concept already.

- Can we make a good interface for the user to do parameter mapping

AGREED - Start with a simple test, then maybe talk to Paul Kienzle

### Include more complex structure factors

- Discussion of the implementation of F(Q)
- We don’t have complex amplitudes
- Use case : Janus particles - but can cheat it with end capped cylinder

- We don’t have complex amplitudes
- Discussion of SasFit / SasView
- More ways of dealing with structure factors
- Orientationally dependent structure factors
- e.g. Beta - Now in SasView

- Structure factors that depend on form factor (amplitude)
- More ways of dealing with polydispersity
- Beta - Now in SasView
- Locally monodisperse

- Orientationally dependent structure factors
- Other Models
- OZ Solver

- More ways of dealing with structure factors
- pyPRISM - will be implemented in SasView by Tyler Martin
- Probably for most cases nee to just write analytical ones
- Yun - Most cases will only be good for hard sphere and spherical particles
- Yun - Continuous distributions in OZ framework is hard
- Yun - should go for numerical solutions for more complex interaction potentials
- Yun - for e.g. mixture of latex and gold, need cross terms, so need complex amplitudes

- Sylvain - Finish decoupling approximation first? For spherical.

AGREED - Finish decoupling and Prism before talking more. This then becomes lower priority, since what is left is both quite complicated and not easy to be general (i.e. each solution will work for a very small number of cases).

### Include material from Scatter

- Andrew has had student working on this. It is quite difficult. Key is the use of hypergeometric functions. This might also be good for integration speeds in general (see below).
- MLZ have been working on it too for a few simple models.
- They have some proof of concept in BornAgain
- Need to work out API to work with SasView

AGREED - Aim for next Code Camp to have BornAgain team integrate their code. Also check SasFit - Joachim may have implemented already.

### 1D oriented data - How to fit a slice from a 2D data sets (oriented objects, magnetic scattering, etc.)

- Should we do it?
- If we are going to provide live access to fast computers
- If not too hard maybe do anyway .. a number of users with good cases

- How would we do it?
- Make special 1D models
- Or use existing 2D models and just pull out appropriate cuts

- Using 2D would be better because
- Code exists and keeps us moving in the direction of full use of the data
- Can in fact properly match "smearing" from integrating over some angular range (e.g. 90 ± 10 deg)
- BUT need to check if speed is fast enough this way

- How to present to the user (UI)
- Probably use existing slicer infrastructure
- How to show the slicer options to the user?
- Need to move slicer computational code out of GUI package (there is a ticket)

- Probably use existing slicer infrastructure
- Narayan / Sylvain to find some example data.
- Maybe start with simulation and treat as real data to test process

AGREED - AJJ to make some simulated data and share with everyone. Sylvain to try scripting 1D from 2D to validate and check speed.

### Project to do benchmarking of optimisers

- Wojciech : Idea is that there is a summer student at ISIS working with Anders
- Mantid have been testing their optimisers seeing how they perform on different classes of problems.
*Want to do something similar for SasView
- Test SasView optimisers against their defined problems
- Identify classes of problems that would be representative for the SANS community

- AJJ - Do you need to know the answer? Else how to benchmark?
- AJJ - how is SANS mathematically different from other test cases?
- RKH - What about things where we have models that have multiple possible simulations?

- Mantid have been testing their optimisers seeing how they perform on different classes of problems.
*Want to do something similar for SasView

AGREED - Wojciech will try to get a better understanding of exactly what the SasView community can help with. Simulated data would seem to be the best for this?

### Computation speed and integration options and approaches

- Ingo : Suggestion - Can we improve the integrations inside models.
- Goal: to get rid of nested integrals
- Need to ensure that solution works with GPUs, multi cpu and headless modes of operatoin and is compatible with our BSD license so may be balancing competing requirements?
- Testing already … some models have numerical integration problems. Work underway.

- Richard - will always have convergence issues for large particles. Or at least with particles that have one dimension that is massively larger than the other.
- Use lebchev(?) Integrals? - some unrolled already- but other would require
- Hypergeometric functions (see Scatter discussion above) in principle can help with very fast integration but are they generic enough a solution to be implemented in models of SasView?

- Goal: to get rid of nested integrals

AGREED - AJJ to find code from Johan on hypergeometric integrals. Then get summer student to demonstrate use in some existing models along with performance enhancement metrics.