perwin / pyimfit Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for Imfit (https://github.com/perwin/imfit)
License: GNU General Public License v3.0
Python wrapper for Imfit (https://github.com/perwin/imfit)
License: GNU General Public License v3.0
Hi,
I tried to install Pyimfit onto my Ubuntu machine via the pip3 install command, but I'm getting this error when compiling: check_gcc_version() got an unexpected keyword argument 'getVersion'
I checked through your setup.py and believe the error is in line 212 ( gccVersionNum = check_gcc_version(getVersion=True)). In the definition of check_gcc_version, the keyword is getVersionNum. I believe this is what is causing the compilation error when installing on Linux when the gcc version is checked.
Hello,
I'm trying to install pyimfit on my Windows 10 machine through Anaconda. Even though I have updated my current version on numpy, running the command:
pip install pyimfit --use-pep517
Gives me following output:
Collecting pyimfit
Using cached pyimfit-0.12.0.tar.gz (10.7 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
[17 lines of output]
Traceback (most recent call last):
File "C:\Users*\AppData\Roaming\Python\Python39\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main()
File "C:\Users*\AppData\Roaming\Python\Python39\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main
json_out['return_val'] = hook(hook_input['kwargs'])
File "C:\Users*\AppData\Roaming\Python\Python39\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users*\AppData\Local\Temp\pip-build-env-zbj5j6jk\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "C:\Users*\AppData\Local\Temp\pip-build-env-zbj5j6jk\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
self.run_setup()
File "C:\Users*\AppData\Local\Temp\pip-build-env-zbj5j6jk\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
super(_BuildMetaLegacyBackend,
File "C:\Users*\AppData\Local\Temp\pip-build-env-zbj5j6jk\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
exec(code, locals())
File "", line 25, in
ModuleNotFoundError: No module named 'numpy'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
Where I can find source code of ModelObjectWrapped class?
How CreateModelIMage works?
At the moment, fit parameters obtained via getRawParameters
are returned as a np.array
object. This is not particularly convenient as the names of the parameters aren't necessarily known, and I can't see nice way of mapping array indices to parameter names.
I would suggest that getRawParameters
should return a (nested) dictionary, like:
{component_1:
{par_name1: val1, par_name2: val2},
component_2:
{par_name1: val1, par_name2: val2},
...}
Apologies if this functionality already exists.
Generating a model image results in a 1-pixel offset in both x and y. I assumed that (x, y) pixel coordinates are 0-indexed (i.e., Python convention). Are they actually 1-indexed? I couldn't find anything in documentation about the pixel coordinate convention.
import pyimfit
shape = (101, 101)
x0 = 50
y0 = 50
pa = 90.0
ell = 0.2
n = 4
I_e = 1
r_e = 25
model = pyimfit.SimpleModelDescription()
model.x0.setValue(x0, [x0 - 5, x0 + 5])
model.y0.setValue(y0, [y0 - 5, y0 + 5])
gal = pyimfit.make_imfit_function('Sersic', label='galaxy')
gal.PA.setValue(pa, [0, 180])
gal.ell.setValue(ell, [0, 1])
gal.n.setValue(n, [0.5, 5])
gal.I_e.setValue(I_e, [0, 10*I_e])
gal.r_e.setValue(r_e, [0, 10*r_e])
model.addFunction(gal)
imfitter = pyimfit.Imfit(model)
data = imfitter.getModelImage(shape=shape)
I expected this model image to be centered at (x, y) = (50, 50) (the input x0, y0), but it's actually centered at (49, 49):
>>> np.unravel_index(np.argmax(data), data.shape)
(49, 49)
plt.imshow(data)
ls = 'dashed'
color = 'w'
alpha = 0.5
plt.axhline(49, ls=ls, color=color, alpha=alpha)
plt.axvline(49, ls=ls, color=color, alpha=alpha)
Hello Peter,
In descriptions.py
:
def functionSetIndices(self):
"""
Get the indices in the full parameters list corresponding
to the starts of individual function sets/blocks.
Returns
-------
indices : list of int
"""
indices = [0]
for i in range(self.nFunctionSets - 1):
functionsThisSet = self._functionSets[i].functionList()
indices.append(len(functionsThisSet))
return indices
In each iteration it appends len(functionsThisSet)
to list indices
. So if there are >=3 function sets, with with len(functionsThisSet)=1
, the indices will be [0,1,1,...]
, which does not seem to be correct. This leads the additional components not to be fitted, and sometimes also significantly impact the results for the first two components.
Previously, I modified the relevant code to be:
indices.append(indices[-1]+len(functionsThisSet))
and found it working. This issue still exists in v1.0.
Could you please confirm this?
Thank you,
Zuyi
I am able to succesfuly install pyimfit but whenever I try to import it this happens and I am not sure how solve it.
ImportError Traceback (most recent call last)
Cell In[6], line 1
----> 1 import pyimfit
File /opt/anaconda3/lib/python3.11/site-packages/pyimfit/init.py:4
1 # This file defines what is visible to the outside world when the package
2 # (pyimfit) is imported
3 from .descriptions import *
----> 4 from .pyimfit_lib import convolve_image, make_imfit_function, ModelObjectWrapper
5 from .pyimfit_lib import FixImage
6 from .pyimfit_lib import PsfOversampling
ImportError: dlopen(/opt/anaconda3/lib/python3.11/site-packages/pyimfit/pyimfit_lib.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '__Z12AddFunctionsP11ModelObjectRKNSt3__16vectorINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS6_IS8_EEEERSA_RNS2_IiNS6_IiEEEEbiRNS2_INS1_3mapIS8_S8_NS1_4lessIS8_EENS6_INS1_4pairIKS8_S8_EEEEEENS6_ISO_EEEE'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.