gammapy / enrico

Enrico helps you with your Fermi data analysis
http://enrico.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
22 stars 26 forks source link

LC_PLOT_Problem #90

Closed mhashad closed 7 years ago

mhashad commented 8 years ago

Hi,

The command " enrico_plot_lc myanalysis.conf " gives this error, also the configure file attached (I just exchange conf. extention to txt for attaching only).. myanalysis.txt

[LightCurve]: Reading files produced by enrico Traceback (most recent call last): File "/home/mohamed/enrico//bin/enrico_plot_lc", line 30, in lc.PlotLC() File "/home/mohamed/enrico/enrico/lightcurve.py", line 188, in PlotLC self._PlotLC() File "/home/mohamed/enrico/enrico/lightcurve.py", line 286, in _PlotLC fittedFunc = self.CheckNpred(Npred,FluxForNpred,FluxErrForNpred,Npred_detectedindices)#check the errors calculation File "/home/mohamed/enrico/enrico/lightcurve.py", line 391, in CheckNpred ,TgrNpred = plotting.PlotNpred(Npred[detected_indices],Flux[detected_indices],FluxErr[detected_indices]) File "/home/mohamed/enrico/enrico/plotting.py", line 243, in PlotNpred xmin = min(NdN) * 0.8 ValueError: min() arg is an empty sequence

Thanks

davidsanchez commented 8 years ago

Hi

do you fix any parameter in the xml file?

cheers david

mhashad commented 8 years ago

Dear Dr. David, Thanks for your replying.. I didn't fix any parameter in the xml file, I leave it as the enrico xml output.but the problem is solved when I replace the default value of TSlimit to ''1'' in the configure file.

[UpperLimit]#Compute an UL if the TS of the sources is <TSlimit     TSlimit = 1.0            #insead of 25[LightCurve]

Compute an UL if the TS of the sources is <TSlimit

    TSlimit = 1.0             #insead of 25

Is that right? Sincerely,M.Hashad

On Tuesday, May 10, 2016 9:49 AM, davidsanchez <notifications@github.com> wrote:

Hido you fix any parameter in the xml file?cheers david— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

davidsanchez commented 8 years ago

Hi

could you attache your config file that I can reproduce the bug

thanks

mhashad commented 8 years ago

Hi,The config file attached.Thanks alot

On Thursday, May 19, 2016 10:36 AM, davidsanchez <notifications@github.com> wrote:

Hicould you attache your config file that I can reproduce the bugthanks— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

Default config and validation file for Enrico.

#

Besides providing default options it is also used

to check the user config file.

Options without default options here must be

specified in the user config file

Folder where the output will be stored

out = /home/mohamed/fermi/3C454.3J2254.0+1608

verbosity

verbose = yes

Overwrite existing output files. Use with caution

clobber = yes

Submit the job to a cluster?

Submit = no

[target] name = 3C454.3 ra = 343.502 dec = 16.1459 redshift = 0.859001 ebl_model = 4 spectrum = PowerLaw

0=Kneiske, 1=Primack05, 2=Kneiske_HighUV, 3=Stecker05, 4=Franceschini, 5=Finke, 6=Gilmore

fit_tau = yes

[space] xref = 343.502 yref = 16.1459 rad = 10.0 binsz = 0.1 coordsys = CEL proj = AIT phibins = 0

[file] spacecraft = /home/mohamed/fermi/3C454.3J2254.0+1608/L150809101231FC1CEE3E16_SC00.fits event = @/home/mohamed/fermi/3C454.3J2254.0+1608/3c454.txt xml = /home/mohamed/fermi/3C454.3J2254.0+1608/3C454.3_PowerLaw_model.xml tag = TestOf3C454.3

[time] tmin = 346175017.0 tmax = 354901417.0 file = "" type = MET

[energy] emin = 200.0 emax = 1000.0 enumbins_per_decade = 10

[event] irfs = CALDB evclass = 128 evtype = 3

[analysis] zmax = 100

General analysis options

likelihood = unbinned
ComputeDiffrsp = yes
roicut = no
filter = DATA_QUAL==1&&LAT_CONFIG==1&&ABS(ROCK_ANGLE)<52

[environ]

Analysis environment configuration

# Can also be done via shell environment variables
FERMI_DATA_DIR = ""
FERMI_CATALOG_DIR = ""
FERMI_CATALOG = ""
FERMI_DIFFUSE_DIR = ""
FERMI_PREPROCESSED_DIR = ""

[fitting] optimizer = NEWMINUIT ftol = 1e-06

[model]

The following options determine the xml model

diffuse_gal_dir = ""
diffuse_iso_dir = ""
diffuse_gal = ""
diffuse_iso = ""
# user points sources for diffuse catalog sources
# freeze spectral parameters for weak and far away sources:
min_significance = 4.0
max_radius = 3.0

[Spectrum]

Generates fits files or not?

FitsGeneration = yes
#Generates plots (SED, model map)
ResultPlots = yes
#Freeze the spectral index of the source. Has no implication if 0 (Left free to vary)
FrozenSpectralIndex = 0.0
#Use the summed likelihood method
SummedLike = no

[UpperLimit]

Assumed Spectral index

SpectralIndex = 2.3489
# UL method could be Profile or Integral (provided by the fermi collaboration). 
#Poisson is base on the Feldman-Cousins method for low signal. Only 95 % yet available
Method = Profile
envelope = no
#Compute an UL if the TS of the sources is <TSlimit
TSlimit = 25.0
# Confidence level for the Ul computation
cl = 0.95

[LightCurve]

Generates fits files or not?

FitsGeneration = yes
#Number of points for the LC
NLCbin = 101
#Index for the power law. Left free to vary if 0
SpectralIndex = 0.0
MakeConfFile = yes
#Compute Variability index as in the 2FGL. 
ComputeVarIndex = no
#Compute an UL if the TS of the sources is <TSLightCurve
TSLightCurve = 9.0
#Generates control plots
DiagnosticPlots = yes

[FoldedLC]

Number of bins for the orbitally folded LC

NLCbin = 10
#Epoch of phase=0 in MJD, equal to tmin is 0
epoch = 0.0
#Orbital period in days
Period = 0.0

[AppLC]

Generates fits files or not?

FitsGeneration = yes
#Spectral index for the exposure calculation
index = 2.3489
#Number of bins
NLCbin = 10
#bin form data or frozen bin size
binsFromData = no

[Ebin]

Generates fits files or not?

FitsGeneration = yes
NumEnergyBins = 0
#Compute an UL if the TS of the sources is <TSEnergyBins
TSEnergyBins = 9.0

[TSMap]

Re-fit before computing the TS map

Re-Fit = no
#Numbers of pixel in x and y
npix = 10
#Remove or not the target from the model
RemoveTarget = yes
#Generate the TS map pixel by pixel or by grouping the pixels by row.
#(reduce the numbers of jobs but each job is longer)
method = row

[findsrc]

Generates fits files or not?

FitsGeneration = no
#Reoptimize before
Refit = yes

[srcprob]

Generates fits files or not?

FitsGeneration = yes
#radius for the computation
rad = 1.0
# list of sources 
srclist = ""
# number of photons to print
numberPhoton = 10

[Contours] parname1 = Prefactor parname2 = Index

davidsanchez commented 8 years ago

Hi,

I am not yet able to reproduce the bug; This seems that Npred is not filled in the LC generation. Do you have the output log and the .results files in the LC folder

cheers david

KaurNav commented 7 years ago

Hi,

I am using enrico for the first time. I am also getting the same error, as @mhashad pointed out, while plottign LCs using 'enrico_plot_lc myanalysis.conf'.

And, I also tried changing TSlimit to 1.0 (as mentioned in one of reply by @mhashad), instead of 25. But it is still giving the same error. Any idea why this is happening?

And one more thing, does Kapteyn is necessary for the plotting LCs, here?


Traceback (most recent call last): File "/home/......./enrico-master/bin/enrico_plot_lc", line 30, in lc.PlotLC() File "/homee/......./enrico-master/enrico/lightcurve.py", line 188, in PlotLC self._PlotLC() File "/home/......./enrico-master/enrico/lightcurve.py", line 286, in _PlotLC fittedFunc = self.CheckNpred(Npred,FluxForNpred,FluxErrForNpred,Npred_detectedindices)#check the errors calculation File "/homee/......./enrico-master/enrico/lightcurve.py", line 391, in CheckNpred ,TgrNpred = plotting.PlotNpred(Npred[detected_indices],Flux[detected_indices],FluxErr[detected_indices]) File "/homee/......./enrico-master/enrico/plotting.py", line 243, in PlotNpred xmin = min(NdN) * 0.8

ValueError: min() arg is an empty sequence

Hopefully, Nav

mhashad commented 7 years ago

Hi, KaurNav Could you attach your config file in order to download your target and try to carry out it for error check!

KaurNav commented 7 years ago

Hi,

Thanks for your reply! I notice the enrico analysis breaks down with large number of "NLCbin" size. May be some issue with memory allocation to the data generated. Then I used individual PH files for analysis and it runs perfectly fine. Another issue in it is that in some cases when I ran individual analysis on Photon file, I could not see other plots (like counts plot, resudual plots) in Spectrum folder, which are supposed to be an outcome while running enrico_sed myanalysis.conf. Do you have any idea about it? Or it is okay, becuse I am able to get the LC but with warning of problem in calculating errors and it plots upper limits of error, ofcourse!

regards, Nav

PS: Please find the config file attached below:

Default config and validation file for Enrico.

#

Besides providing default options it is also used

to check the user config file.

Options without default options here must be

specified in the user config file

Folder where the output will be stored

out = /shared_phpc_home/home/sameer/Navpreet/fermi_3c66a/myanalysis

verbosity

verbose = yes

Overwrite existing output files. Use with caution

clobber = yes

Submit the job to a cluster?

Submit = no

[target] name = #### ra = #### dec = #### redshift = #### ebl_model = 4 spectrum = PowerLaw2

0=Kneiske, 1=Primack05, 2=Kneiske_HighUV, 3=Stecker05, 4=Franceschini, 5=Finke, 6=Gilmore

fit_tau = yes

[space] xref = ## yref = ## rad = 15.0 binsz = 0.1 coordsys = CEL proj = AIT phibins = 0

[file] spacecraft = /home/..../spacefile.fits event = /home/...../data.list xml = /home/........./myanalysis/###_PowerLaw2_model.xml tag = ##_set1

[time] tmin = 239557417.0 tmax = 272422610.0 file = "" type = MET

[energy] emin = 200.0 emax = 300000.0 enumbins_per_decade = 10

[event] irfs = CALDB evclass = 128 evtype = 3

[analysis] zmax = 95

General analysis options

likelihood = binned
ComputeDiffrsp = yes
roicut = no
filter = (DATA_QUAL>0)&&(LAT_CONFIG==1)

[environ]

Analysis environment configuration

# Can also be done via shell environment variables
FERMI_DATA_DIR = ""
FERMI_CATALOG_DIR = ""
FERMI_CATALOG = ""
FERMI_DIFFUSE_DIR = ""
FERMI_PREPROCESSED_DIR = ""

[fitting] optimizer = MINUIT ftol = 1e-06

[model]

The following options determine the xml model

diffuse_gal_dir = ""
diffuse_iso_dir = ""
diffuse_gal = ""
diffuse_iso = ""
# user points sources for diffuse catalog sources
# freeze spectral parameters for weak and far away sources:
min_significance = 4.0
max_radius = 3.0

[Spectrum]

Generates fits files or not?

FitsGeneration = yes
#Generates plots (SED, model map)
ResultPlots = yes
#Freeze the spectral index of the source. Has no implication if 0 (Left free to vary)
FrozenSpectralIndex = 0.0
#Use the summed likelihood method
SummedLike = no

[UpperLimit]

Assumed Spectral index

SpectralIndex = 1.5
# UL method could be Profile or Integral (provided by the fermi collaboration). 
#Poisson is base on the Feldman-Cousins method for low signal. Only 95 % yet available
Method = Profile
envelope = no
#Compute an UL if the TS of the sources is <TSlimit
TSlimit = 1.0
# Confidence level for the Ul computation
cl = 0.95

[LightCurve]

Generates fits files or not?

FitsGeneration = yes
#Number of points for the LC
NLCbin = 55
#Index for the power law. Left free to vary if 0
SpectralIndex = 0.0
MakeConfFile = yes
#Compute Variability index as in the 2FGL. 
ComputeVarIndex = yes
#Compute an UL if the TS of the sources is <TSLightCurve
TSLightCurve = 10.0
#Generates control plots
DiagnosticPlots = yes

[FoldedLC]

Number of bins for the orbitally folded LC

NLCbin = 10
#Epoch of phase=0 in MJD, equal to tmin is 0
epoch = 0.0
#Orbital period in days
Period = 0.0

[AppLC]

Generates fits files or not?

FitsGeneration = yes
#Spectral index for the exposure calculation
index = 1.5
#Number of bins
NLCbin = 10
#bin form data or frozen bin size
binsFromData = no

[Ebin]

Generates fits files or not?

FitsGeneration = yes
NumEnergyBins = 0
#Compute an UL if the TS of the sources is <TSEnergyBins
TSEnergyBins = 9.0

[TSMap]

Re-fit before computing the TS map

Re-Fit = no
#Numbers of pixel in x and y
npix = 10
#Remove or not the target from the model
RemoveTarget = yes
#Generate the TS map pixel by pixel or by grouping the pixels by row.
#(reduce the numbers of jobs but each job is longer)
method = row

[findsrc]

Generates fits files or not?

FitsGeneration = yes
#Reoptimize before
Refit = yes

[srcprob]

Generates fits files or not?

FitsGeneration = yes
#radius for the computation
rad = 1.0
# list of sources 
srclist = ""
# number of photons to print
numberPhoton = 10

[Contours] parname1 = Prefactor parname2 = Index

davidsanchez commented 7 years ago

I finally find time and fix it cheers david