Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during execution of gtselect #130

Closed
basuparth opened this issue Feb 27, 2019 · 17 comments · Fixed by #131
Closed

Error during execution of gtselect #130

basuparth opened this issue Feb 27, 2019 · 17 comments · Fixed by #131

Comments

@basuparth
Copy link

This error is occurring intermittently while running enrico_sed, enrico_lc. Presently I am running enrico_lc for 20bins and for the very first bin the following error report occurred and enrico went onto the next time interval but this time no error was reported and enrico went through all the steps perfectly.

************************************************************

*** 1 gtselect --- Select data from library, coarse cut

************************************************************

time -p gtselect infile=/home/parth/enrico/data/PG155+113_PG155+113_EvtCoarse.fits outfile=/home/parth/enrico/data/LightCurve_20bins//PG155+113_PG155+113_LC_0_EvtCoarse.fits ra=238.92935 dec=11.190101 rad=15.0 tmin=555765698.0 tmax=556543297.975 emin=100.0 emax=300000.0 zmin=0.0 zmax=90.0 evclass=128 evclsmin=0 evclsmax=10 evtype="INDEF" convtype=-1 phasemin=0.0 phasemax=1.0 evtable="EVENTS" chatter=2 clobber=yes debug=no gui=no mode="ql"

WARNING: version mismatch between CFITSIO header (v3.43) and linked library (v3.41).

Invalid parameter name in command line assignment: "evclsmin"
Invalid parameter name in command line assignment: "evclsmin"
Caught N5hoops12ApeExceptionE at the top level: Cannot open parameter file for gtselect; Ape exception code 22 (at /opt/conda/conda-bld/fermitools_1539624540941/work/hoops/build/centos6-x86_64-64bit-gcc48/src/hoops_ape.cxx: 435)
Traceback (most recent call last):
File "/home/parth/enrico/bin/enrico_sed", line 53, in
sed(config,infile)
File "/home/parth/enrico/bin/enrico_sed", line 13, in sed
run(infile)
File "/home/parth/enrico/enrico/RunGTlike.py", line 143, in run
FitRunner,Fit = GenAnalysisObjects(config)
File "/home/parth/enrico/enrico/RunGTlike.py", line 119, in GenAnalysisObjects
tag=typeirfs[evt], verbose = verbose)
File "/home/parth/enrico/enrico/RunGTlike.py", line 23, in Analysis
FitRunner.FirstSelection(configgeneric) #Generates fits files for the coarse selection
File "/home/parth/enrico/enrico/fitmaker.py", line 48, in FirstSelection
self.obs.FirstCut()
File "/home/parth/enrico/enrico/gtfunction.py", line 241, in FirstCut
filter.run()
File "/home/parth/anaconda2/envs/fermi/lib/python2.7/site-packages/fermitools/GtApp.py", line 76, in run
raise RuntimeError, self.appName + " execution failed"
RuntimeError: gtselect execution failed

@basuparth
Copy link
Author

basuparth commented Feb 27, 2019

update : After running 3 consecutive bins(#1,2,3) successfully the error occurred again for bin#4 followed by a successful resumption of bin#5. Also, enrico is now producing a separate spectrum folder inside the Light Curve#bins folder.

update2(minor query) : I just noticed that evtype = INDEF but in the summary report it is acknowledged that I specified evtype=3.

@mireianievas I apologize for tagging you again but could you please look into this.

@mireianievas
Copy link
Contributor

update : After running 3 consecutive bins(#1,2,3) successfully the error occurred again for bin#4 followed by a successful resumption of bin#5.

Perhaps related to #64 ?

Also, enrico is now producing a separate spectrum folder inside the Light Curve#bins folder.

Spotted and corrected, added to the same pull request as #129 (#128) .

update2(minor query) : I just noticed that evtype = INDEF but in the summary report it is acknowledged that I specified evtype=3.

Where is that evtype = INDEF occurring?. At some point it may happen that we do not need to specify the evtype anymore if the data has been already filtered. But it is worth to double check anyway.

@basuparth
Copy link
Author

I am not sure about #64. Although the two error reports are similar the fact that gtselect is executed on some occasions and not on others is confusing me. I am using the same myanalysis.conf file which I used for generating the flux points(which culminated in a completely successful run). And the fermi tools are the recent conda version where none of the pfiles have been tampered with. However, I was also running a simultaneous analysis in another terminal window with an older enrico installation from the fermi environment of version (v11r5p3) . Could it be possible that while initiating enrico from two different terminals at the same time with the same alias of ENRICO_DIR the system got confused ? But I had run enrico_setupcheck in both the terminal windows separately where all the specifics pointed to their respective fermi environments alone.

evtype=INDEF is occurring for gtselect(coarse cut){incidentally the same operation which throws the intermittent error} and then from gtselect(fine cut) it specifies evtype=3 all the way through during every other operation.

@basuparth
Copy link
Author

@mireianievas I made all the changes in 9be3dc3 , 0cc9f76 , fefa855, fe6904b . I tried to run a fresh analysis with these changes with enrico_sed but enrico threw the following error after executing all the steps from gtselect to gtmodel.

error report:

rm: cannot remove '/home/parth/enrico/d/PG155+113_Subtract_Model_cmap.fits': No such file or directory
rm: cannot remove '/home/parth/enrico/d/PG155+113_Residual_Model_cmap.fits': No such file or directory
Traceback (most recent call last):
File "/home/parth/enrico/bin/enrico_sed", line 53, in
sed(config,infile)
File "/home/parth/enrico/bin/enrico_sed", line 13, in sed
run(infile)
File "/home/parth/enrico/enrico/RunGTlike.py", line 191, in run
with get_config(infile) as config_to_plot:
AttributeError: exit
myanalysis.txt

@mireianievas
Copy link
Contributor

mireianievas commented Feb 28, 2019

I think it has to do with this commit that I forgot to push yesterday: #128 (b99d07a). Could you check?

@basuparth
Copy link
Author

Thanks @mireianievas , yes that error is fixed but now before submitting the fit into energy bins enrico is throwing a series of warning messages

[Message]: Save Ebin results in
[Message] Warning: cannot read the Results of energy bin 0
[Message] Warning: cannot read the Results of energy bin 1
[Message] Warning: cannot read the Results of energy bin 2
[Message] Warning: cannot read the Results of energy bin 3
[Message] Warning: cannot read the Results of energy bin 4
[Message] Warning: cannot read the Results of energy bin 5
[Message] Warning: cannot read the Results of energy bin 6
[Message] Warning: cannot read the Results of energy bin 7
[Message] Warning: cannot read the Results of energy bin 8
[Message] Warning: cannot read the Results of energy bin 9
[Message]: Save Ebin results in
[Message] Warning: cannot read the Results of energy bin 0
[Message] Warning: cannot read the Results of energy bin 1
[Message] Warning: cannot read the Results of energy bin 2
[Message] Warning: cannot read the Results of energy bin 3
[Message] Warning: cannot read the Results of energy bin 4
[Message] Warning: cannot read the Results of energy bin 5
[Message] Warning: cannot read the Results of energy bin 6
[Message] Warning: cannot read the Results of energy bin 7
[Message] Warning: cannot read the Results of energy bin 8
[Message] Warning: cannot read the Results of energy bin 9

************************************************************

*** Preparing submission of fit into energy bins ***

************************************************************

(' Emin = ', 100.0, ' Emax = ', 300000.0, ' Nbins = ', 10)
[Message]: Submitting # 0 at energy 149
[Message]: Submitting # 1 at energy 332
[Message]: Submitting # 2 at energy 740
[Message]: Submitting # 3 at energy 1648
[Message]: Submitting # 4 at energy 3670
[Message]: Submitting # 5 at energy 8173
[Message]: Submitting # 6 at energy 18202
[Message]: Submitting # 7 at energy 40536
[Message]: Submitting # 8 at energy 90272
[Message]: Submitting # 9 at energy 201031

@mireianievas
Copy link
Contributor

Yeah, that is expected since the plotting of the spectrum takes place after the general fit is done and before the energy bins are analyzed. It will also partially pop up as the individual energy bins are processed one by one until the last one, which should produce a clean output. It is part of the changes I did to fix #129.

I'm not sure how to avoid it without making the code unnecessarily complex, but I will have a look.

@basuparth
Copy link
Author

Oh okay I see, enrico is now generating the plots and data file in the spectrum folder without needing us to run enrico_plot_sed but the analysis of the individual bins wasn't completed. Thanks again. btw are all the changes merged into the master version ?

@mireianievas
Copy link
Contributor

Not yet.

I have created a variable that is passed over all functions to avoid printing those warnings while enrico_sed is executed. They should be printed if enrico_plot_sed is executed though.

Should the same behavior been applied also to the light curves?

@basuparth
Copy link
Author

I haven't checked lightcurve yet. I will run it now and let you know as soon as it is done.

@basuparth
Copy link
Author

lightcurve doesn't throw the warning messages but gives the error message before moving onto the next energy bin.

Traceback (most recent call last):
File "/home/parth/enrico/bin/enrico_sed", line 53, in
sed(config,infile)
File "/home/parth/enrico/bin/enrico_sed", line 13, in sed
run(infile)
File "/home/parth/enrico/enrico/RunGTlike.py", line 194, in run
plot_sed_fromconfig(get_config(config['file']['parent_config']))
File "/home/parth/enrico/enrico/plotting.py", line 554, in plot_sed_fromconfig
PlotSED(config,Param)
File "/home/parth/enrico/enrico/plotting.py", line 433, in PlotSED
lines = open(filebase + '.dat', 'r').readlines()
IOError: [Errno 2] No such file or directory: '/home/parth/enrico/d/LightCurve_20bins//Spectrum/SED_PG155+113_PowerLaw.dat'

enrico_sed also throws a similar error pointing to the absence of the .dat file before moving onto the next bin analysis. Is enrico going to deposit the result of the bins in the .dat file at the end of the entire operation ?(because I was thinking that the code will be depositing the results of individual bins one at a time gradually populating the .dat file )

************************************************************

*** 12 PlotSED --- Generate SED plot

************************************************************

Traceback (most recent call last):
File "/home/parth/enrico/enrico/RunGTlike.py", line 216, in
run(infile)
File "/home/parth/enrico/enrico/RunGTlike.py", line 194, in run
plot_sed_fromconfig(get_config(config['file']['parent_config']))
File "/home/parth/enrico/enrico/plotting.py", line 554, in plot_sed_fromconfig
PlotSED(config,Param)
File "/home/parth/enrico/enrico/plotting.py", line 433, in PlotSED
lines = open(filebase + '.dat', 'r').readlines()
IOError: [Errno 2] No such file or directory: '/home/parth/enrico/d/Ebin10/Spectrum/SED_PG155+113_PowerLaw.dat'

mireianievas pushed a commit to mireianievas/enrico that referenced this issue Feb 28, 2019
@mireianievas mireianievas mentioned this issue Feb 28, 2019
@mireianievas
Copy link
Contributor

mireianievas commented Feb 28, 2019

@basuparth, could you check with the commit I just made? @davidsanchez do not accept the pull request until this fix is tested and the issue is solved.

@basuparth
Copy link
Author

basuparth commented Feb 28, 2019

the warning messages are suppressed but the error message persists,


*** 12 PlotSED --- Generate SED plot

************************************************************

Traceback (most recent call last):
File "/home/parth/enrico/enrico/RunGTlike.py", line 219, in
run(infile)
File "/home/parth/enrico/enrico/RunGTlike.py", line 191, in run
plot_sed_fromconfig(get_config(config['file']['parent_config']),ignore_missing_bins=True)
File "/home/parth/enrico/enrico/plotting.py", line 555, in plot_sed_fromconfig
PlotSED(config,Param,ignore_missing_bins)
File "/home/parth/enrico/enrico/plotting.py", line 434, in PlotSED
lines = open(filebase + '.dat', 'r').readlines()
IOError: [Errno 2] No such file or directory: '/home/parth/enrico/d/Ebin3/Spectrum/SED_PG155+113_PowerLaw.dat'

**edit/update : After the operation ended the dat file and the resulting plot were both vacant and executing enrico_plot_sed gave the required .dat file and the plot(as earlier). **
**Query: Why does the error message refer to the .dat file as SED_PG155+113_PowerLaw.dat' when the file actually created in the folder is ------PowerLaw2.dat ? **

@basuparth
Copy link
Author

basuparth commented Feb 28, 2019

lightcurve : During the end of gtsrcmap operation the following message is displayed

Parameter Index not found for source PG155+113 in file /home/parth/enrico/d/LightCurve_5bins/0_555765698.0_558876097.898.xml.

followed by the gtlike operation where the sourcemap of PG155+113 was generated successfully.
This was the first bin after which enrico threw a long error report

[LightCurve]: Running LC with 5 bins
Bin 0 Start= 555765698.0 Stop= 558876097.898
Bin 1 Start= 558876097.898 Stop= 561986497.797
Bin 2 Start= 561986497.797 Stop= 565096897.695
Bin 3 Start= 565096897.695 Stop= 568207297.594
Bin 4 Start= 568207297.594 Stop= 571317697.492

[LightCurve]: Reading files produced by enrico
[LightCurve] Warning: Fail reading config file : /home/parth/enrico/d/LightCurve_5bins/Config_1_558876097.898_561986497.797
Job Number : 1
[LightCurve] Warning: Please have a look at this job log file
[LightCurve] Warning: Fail reading config file : /home/parth/enrico/d/LightCurve_5bins/Config_2_561986497.797_565096897.695
Job Number : 2
[LightCurve] Warning: Please have a look at this job log file
[LightCurve] Warning: Fail reading config file : /home/parth/enrico/d/LightCurve_5bins/Config_3_565096897.695_568207297.594
Job Number : 3
[LightCurve] Warning: Please have a look at this job log file
[LightCurve] Warning: Fail reading config file : /home/parth/enrico/d/LightCurve_5bins/Config_4_568207297.594_571317697.492
Job Number : 4
[LightCurve] Warning: Please have a look at this job log file
Traceback (most recent call last):
File "/home/parth/enrico/bin/enrico_plot_lc", line 30, in
lcobject.PlotLC()
File "/home/parth/enrico/enrico/lightcurve.py", line 220, in PlotLC
self._PlotLC()
File "/home/parth/enrico/enrico/lightcurve.py", line 339, in PlotLC
popt,
= scipy.optimize.curve_fit(pol1, NdN, FdF, p0=[0,1])#, sigma=dydata)
File "/home/parth/anaconda2/envs/fermi/lib/python2.7/site-packages/scipy/optimize/minpack.py", line 736, in curve_fit
res = leastsq(func, p0, Dfun=jac, full_output=1, **kwargs)
File "/home/parth/anaconda2/envs/fermi/lib/python2.7/site-packages/scipy/optimize/minpack.py", line 380, in leastsq
raise TypeError('Improper input: N=%s must not exceed M=%s' % (n, m))
TypeError: Improper input: N=2 must not exceed M=1

edit/update : the lightcurve analysis was completed and produced the plots as expected with all the 5 points inspite of the error messages above.

@mireianievas
Copy link
Contributor

the warning messages are suppressed but the error message persists,

*** 12 PlotSED --- Generate SED plot

************************************************************

Traceback (most recent call last):
File "/home/parth/enrico/enrico/RunGTlike.py", line 219, in
run(infile)
File "/home/parth/enrico/enrico/RunGTlike.py", line 191, in run
plot_sed_fromconfig(get_config(config['file']['parent_config']),ignore_missing_bins=True)
File "/home/parth/enrico/enrico/plotting.py", line 555, in plot_sed_fromconfig
PlotSED(config,Param,ignore_missing_bins)
File "/home/parth/enrico/enrico/plotting.py", line 434, in PlotSED
lines = open(filebase + '.dat', 'r').readlines()
IOError: [Errno 2] No such file or directory: '/home/parth/enrico/d/Ebin3/Spectrum/SED_PG155+113_PowerLaw.dat'

**edit/update : After the operation ended the dat file and the resulting plot were both vacant and executing enrico_plot_sed gave the required .dat file and the plot(as earlier). **
**Query: Why does the error message refer to the .dat file as SED_PG155+113_PowerLaw.dat' when the file actually created in the folder is ------PowerLaw2.dat ? **

Can you attach the full log file?

@mireianievas
Copy link
Contributor

Please, try to open different tickets for each non-related issue. The error in the light curve is probably due to the fact that you do not have enough points to perform the diagnostic plot Npred vs flux around line 328 of lightcurve.py. Simply changingthe if condition will probably fix it ...

if len(Npred_detected)>2:

I will add it to the next commit.

@basuparth
Copy link
Author

I can't find any logfile with the report of this error. The error report displayed on the terminal occurs while executing the operation 12, (Plot SED).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants