megalut / sewpy

Source Extractor Wrapper for Python
GNU General Public License v3.0
22 stars 11 forks source link

Sewpy does not read the params list from my config file #22

Closed nandinihazra closed 3 years ago

nandinihazra commented 3 years ago

Hi

I'm running Sewpy to detect objects in a FITS file from within my python code, using this command :

sew=sewpy.SEW(workdir='/home/hazra/Documents/git/sbf_hsc/out', sexpath="sex", configfilepath='/home/hazra/Documents/git/sbf_hsc/sewpy_lsst_extended.par',loglevel=None)

In my sewpy_lsst_extended.par file there is a specific line PARAMETERS_NAME default.param.lsst

And this seems to work as expected when I run sextractor from my terminal in this directory with this config dict and parameter file. However, sewpy doesn't seem to detect this param file at all and uses the internal default list of parameters.

Is there something glaringly wrong in what I am doing?

Thank you so much Nandini Hazra

mtewes commented 3 years ago

Hi Nandini, sewpy will currently ignore the PARAMETERS_NAME that might be set in a configuration file, and give precedence to the "params=None" argument (meaning: use default params) of the SEW init, as you observe. If I remember well, there is no deep reason for this, it was done to keep it as simple as possible and avoid having to parse the configuration file. Anyway, the workaround is to specify PARAMETERS_NAME in the config dict when calling SEW. So add config={"PARAMETERS_NAME":"default.param.lsst"} to your sew=sewpy.SEW line, and it should work. Cheers!

nandinihazra commented 3 years ago

Thank you so much, Malte! Does it do the same for the gaussian filter and nnw files (override with internal defaults)?

mtewes commented 3 years ago

Yes, exactly. So you would add "FILTER_NAME":"..." etc to the config-dict.

nandinihazra commented 3 years ago

Thank you so, so much! Have a nice day :)