Comments (6)
That's a good suggestion. It might be better to add a new function (since it's useful to have the existing function return a pure numpy array in certain circumstances); let me look into what might be the best solution.
from pyimfit.
Sorry for the delay in working on this. I'm currently thinking it would make sense to have two new "parameter return" methods (in addition to getRawParameters
):
-
A method which returns a list of OrderedDict entries, one for each function set; internally, each element of the list would resemble your suggestion (the dicts for each component would also be OrderedDicts):
[ {component_1: {par_name1: val1, par_name2: val2}, component_2: {par_name1: val1, par_name2: val2}, ...}, {component_1: {par_name1: val1, par_name2: val2}, ... ]
-
A method which returns ModelDescription object.
How does that sound?
from pyimfit.
Sorry for the delay in working on this. I'm currently thinking it would make sense to have two new "parameter return" methods (in addition to
getRawParameters
):
- A method which returns a list of OrderedDict entries, one for each function set; internally, each element of the list would resemble your suggestion (the dicts for each component would also be OrderedDicts):
[ {component_1: {par_name1: val1, par_name2: val2}, component_2: {par_name1: val1, par_name2: val2}, ...}, {component_1: {par_name1: val1, par_name2: val2}, ... ]
- A method which returns ModelDescription object.
How does that sound?
@perwin Sounds great! Thanks for working on this.
from pyimfit.
Here's my current idea for the dict output. The idea is that this is a format which can also be used to define a new ModelDescription object; it also needs to handle the possibility of multiple function sets, which makes it more complicated than your initial suggestion.
{ 'options': optionsDict or None, 'function_sets': list of function-set dicts }
where
optionsDict = {'GAIN':float, 'ORIGINAL_SKY': float, etc.}
and individual function-set dicts look like this (one per function set in the model):
{ 'name': str or None [default], 'X0': x0-value, 'Y0': y0-value, 'function-list': list of function dicts }
Function dicts look like this:
{ 'name': str ["Exponential", "Sersic", etc.], 'label' : str or None [default], 'parameters' : parameters-dict }
Finally, parameter dicts are OrderedDicts with str: float pairs, e.g.
{ 'PA': 45.0, 'ell': 0.23, 'I_0': 103.2, 'h': 22.1}
A very simple example, for a model with a single Gaussian component (ignoring any image-description parameters like GAIN, etc.):
bestfit_model = { 'function_sets': [{'X0': 1023.2, 'Y0': 985.4,
'function_list': [{'name': 'Gaussian",
'parameters': {'PA': 0.0, 'ell': 0.2, 'I_0': 1.0, 'sigma': 12.3}}] }] }
The parameter dicts might be modified to contain optional limits/'fixed' specifications, or perhaps this would be better handled by an optional 'parameter_limits' dict as part of the function dict.
How does that look to you?
from pyimfit.
There is (finally) a new release (0.11.1) incorporating the return-fitted-model-as-dict functionality (including the ability to define new ModelDescription objects using dicts). You should be able to install it via pip.
from pyimfit.
I'm going to close this issue, but feel free to re-open it if there are problems with the dict return functionality.
from pyimfit.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyimfit.