rlopezcoto / EDGE

3 stars 3 forks source link

Changing the spectrum of injected electrons to single peak emission #6

Closed jasonfan1997 closed 6 years ago

jasonfan1997 commented 6 years ago

Hi. I want to calculate how would the result gamma ray spectrum and electron spectrum on earth if the injection spectrum is a single peak emission which might due to dark matter compact mini halo annihilation.But I having trouble in changing the injecting spectrum to a single peak emission. Can you give some advises?Thank you very much for your help.

rlopezcoto commented 6 years ago

Hi,

do you want to change the spectrum of the particles injected or how fast they are injected? If you want to have something like a burst-like scenario, you would have to change the $\tau$ parameter from the code very small to a very small value (most of the energy injected at the beginning of the injection). If you want to have a source that is continuing injecting electrons, the $\tau$ parameter should be of the order of the source age.

Cheers

jasonfan1997 commented 6 years ago

Hi I want to have a source that is continuing injecting electrons and it only emit electron with one particular energy.What other things should I change?

Best

rlopezcoto commented 6 years ago

hi, then you should use the -tau=source_age (continuous emission), -emin=E -emax=E -eb=1 (maximum=minimum energy and the binning in energy=1). Never tried anything like this, so please let me know if it does not work. Best

jasonfan1997 commented 6 years ago

when i try to run it, this error appear python EDGE.py -d 0.1 -emax 1.4 -emin 1.4 -m 0 -eb 1 ('Age ', 330000.0) ('Characteristic age ', 342000.0) ('TAU0', 12000.0) ('Edot', 3.2e+34) ('LUM0', 2.5992e+37) EDGE.py:222: RuntimeWarning: divide by zero encountered in log10 return np.log10(lumBurst),np.log10(lumCont),lum0,tau0,age,edot EDGE.py:611: RuntimeWarning: invalid value encountered in divide plt.loglog(10.LUMCONT[:,0],10.LUMCONT[:,1]/MU,label="Pulsar evolution luminosity")

CALCULATING IC LOSS LOOKUP 100% done -> DONE!

COMPUTATION OF IC LOSS LOOKUP COMPLETE

CALCULATING IC LOSS LOOKUP 100% done -> DONE!

COMPUTATION OF IC LOSS LOOKUP COMPLETE

Energy: 1.4000 [TeV] Traceback (most recent call last): File "EDGE.py", line 641, in twoDarray,twoDarrayPLOT,halfwidth,E,R = Create_E_R_ArrayOfElectrons(RBINS,EBINS) File "EDGE.py", line 293, in Create_E_R_ArrayOfElectrons vlamb,DT,E0,E = FillLambdaVector(ee,1000,Age) # We fill the mean free path vector for each of the energies File "EDGE.py", line 330, in FillLambdaVector DT = math.pow(10.,np.interp(math.log10(Enow),ETRAJCONTINVERSE[:,0],ETRAJCONTINVERSE[:,1])) # We interpolate between the first element (that is an array) of ETRAJCONTINVERSE (x=energy) and the second (f(x)=time) to obtain the interpolated time for a given energy
IndexError: too many indices for array

jasonfan1997 commented 6 years ago

Also, If i want to directly input the injection rate, which part of the code should I change?

rlopezcoto commented 6 years ago

Hi, sorry for the late reply. I've been trying to run some tests, but it seems that only with a single energy it cannot work due to the way the particle trajectories in energy are calculated. You can try by running: python EDGE.py -d 0.1 -emin 1. -emax 1.8 -eb 10 that is an interval centered on the energy you are interested in.

if you want to directly input the injection rate without using any of the pulsar-like injections provided, you would have to write a function similar to CalculateLuminosity, or directly pass a variable LUMCONT to the code.