Git Product home page Git Product logo

Comments (6)

perwin avatar perwin commented on June 9, 2024 1

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.

perwin avatar perwin commented on June 9, 2024

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):

  1. 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}, ... ]

  2. A method which returns ModelDescription object.

How does that sound?

from pyimfit.

danjampro avatar danjampro commented on June 9, 2024

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):

  1. 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}, ... ]
  2. A method which returns ModelDescription object.

How does that sound?

@perwin Sounds great! Thanks for working on this.

from pyimfit.

perwin avatar perwin commented on June 9, 2024

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.

perwin avatar perwin commented on June 9, 2024

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.

perwin avatar perwin commented on June 9, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.