Comments (11)
Hi @422314581, thanks for reporting this, I will fix it soon!
It was a bit stupid from my side, but after implementing the interpolated particle distribution I never tried to import it from a Blob or compute its output with a radiative process 😅, so thanks for spotting this.
from agnpy.
I think the easiest solution would be to implement a sinlge parameter, an amplitude
or norm
, multiplying the interpolated distribution. This can be set to 1 by default and, for example, varied in a fit.
@422314581 would you have an example of an electron distribution you are trying to interpolate that you could share with us? I guess you are using the output of some time-dependent code.
We could use it for these tests, instead of interpolating power-law distributions as we already do.
I think it would be very useful.
from agnpy.
Yes, you are right. I want the injection function of the electrons to determine the stationary stationary of electrons. like this
B = 1.8 * u.G
B1 = 1.8
R_b = 2.8e15 * u.cm
R_b1 = 2.8e15
u_b = B12/(8np.pi)
r_b = 3m_e*c2/(4sigma_Tu_bR_b)
r_b = 39.1093837015e-2829979245800.0**2/(46.6524587321000005e-25u_bR_b1)
t_ad = R_b1/29979245800.0
def Q_e(gamma):
return 8.8 * gamma**(-2)np.e*(-gamma/1.8e4)np.e*(r_b/gamma)
def Q1(gamma):
return si.quad(Q_e,gamma,np.inf)[0]
def N(gamma):
return np.e**(-r_b/gamma) * r_b*t_ad /gamma**2 * Q1(gamma)
gamma_min1 = 1.40e+03
gamma_max = 5.00e+04
Gma = np.logspace(np.log10(gamma_min1), np.log10(gamma_max), 100)
Gma = [1400.0000000000005, 1451.4875266914864, 1504.868600100691, 1560.2128588255935, 1617.5925025492952, 1677.082386228548, 1738.7601177462361, 1802.7061591552008, 1869.0039316454931, 1937.7399243719876, 2009.0038072843165, 2082.8885481063508, 2159.490533617791, 2238.9096953961175, 2321.2496401829276, 2406.617785044728, 2495.12549750451, 2586.8882408269174, 2682.0257246465367, 2780.6620611358153, 2882.9259269163385, 2988.9507309246824, 3098.8747884518402, 3212.8415015832625, 3330.9995462748925, 3453.5030663092894, 3580.5118743848093, 3712.1916606002164, 3848.7142086066915, 3990.2576197092185, 4137.006545209707, 4289.152427294947, 4446.893748783661, 4610.436292058447, 4779.993407520415, 4955.786291916725, 5138.0442769041265, 5327.005128224939, 5522.91535588577, 5726.030535743617, 5936.615642918876, 6154.945397470217, 6381.304622782279, 6615.9886171337175, 6859.303538930317, 7111.566806105801, 7373.107510211271, 7644.266845733555, 7925.398555202518, 8216.869390667984, 8519.05959214832, 8832.363383674818, 9157.189487579002, 9493.9616576938, 9843.119232164136, 10205.117706588084, 10580.429328236447, 10969.5437121257, 11372.968479748195, 11791.229921292812, 12224.873682219963, 12674.465475086636, 13140.591817550094, 13623.860797512973, 14124.902866408, 14644.371661657162, 15182.944859378313, 15741.325058451597, 16320.240697099014, 16920.44700317284, 17542.726979392653, 18187.89242481617, 18856.784993876598, 19550.27729436791, 20269.274025810562, 21014.71315968268, 21787.56716305631, 22588.844267235214, 23419.589783048803, 24280.88746451912, 25173.86092267792, 26099.675091380926, 27059.53774702843, 28054.701084178057, 29086.463349101767, 30156.170533421686, 31265.21813003065, 32415.05295359142, 33607.17502798711, 34843.13954318634, 36124.55888407561, 37453.10473390561, 38830.51025509559, 40258.57235024077, 41739.1540062723, 43274.186724828, 44865.673042004375, 46515.68914077701, 48226.387559497445, 49999.99999999999]
n1 = [400.03038267515564, 364.4407824122864, 331.7536549049479, 301.7577319411341, 274.2549764294827, 249.05987916071075, 225.99879682887925, 204.90932616948302, 185.63970992703895, 168.04827112329076, 152.00287275998733, 137.38040066101476, 124.06626764274444, 111.953937605043, 100.94446846566291, 90.94607312514962, 81.87369785567016, 73.64861766284237, 66.19804828205453, 59.4547745467929, 53.3567949125473, 47.846981941752325, 42.87275855815742, 38.385789867597346, 34.341690320336596, 30.69974596137393, 27.42265148222659, 24.476261752867558, 21.829357478073774, 19.453424589126513, 17.322446951484054, 15.412711941978113, 13.702628426022159, 12.172556646503955, 10.804649521591267, 9.582704838579074, 8.492027825006703, 7.519303576343261, 6.6524788212870245, 5.880652510815274, 5.193974725194965, 4.583553403851673, 4.041368415924141, 3.560192504143148, 3.1335186510214883, 2.755493433901441, 2.4208559538781858, 2.1248819427261334, 1.8633326714552045, 1.6324083037949515, 1.4287053575543402, 1.2491779562674181, 1.0911025726683925, 0.9520459842251976, 0.8298361791012582, 0.7225359684328713, 0.6284190776442038, 0.5459485056288753, 0.4737569559752147, 0.41062915898336444, 0.35548591700781523, 0.30736971865954665, 0.26543177962583914, 0.22892037932750542, 0.19717037335224352, 0.1695937716026891, 0.14567128140525204, 0.12494472347009085, 0.10701023660453353, 0.09151219449209418, 0.07813776469585754, 0.06661204634543931, 0.056693728776638246, 0.04817121872021901, 0.04085918852791465, 0.034595502402685045, 0.029238481697073434, 0.024664474085549424, 0.020765694830302293, 0.01744831146997509, 0.014630746090911651, 0.012242171912762051, 0.010221183255677287, 0.008514620074228674, 0.007076530161901148, 0.005867253866396372, 0.004852617725842891, 0.004003224853869804, 0.0032938311808845986, 0.0027027978122132145, 0.0022116108024919615, 0.0018044605803757767, 0.0014678740979228032, 0.0011903935337989687, 0.0009622960568334191, 0.0007753497638635886, 0.0006226014500065597, 0.0004981923566509282, 0.00039719847819719145, 0.0003154923979911541] * u.Unit("cm-3")
from agnpy.
@cosimoNigro Thank you for your help
from agnpy.
Yes, you are right. I want the injection function of the electrons to determine the stationary stationary of electrons. like this
B = 1.8 * u.G B1 = 1.8 R_b = 2.8e15 * u.cm R_b1 = 2.8e15
u_b = B12/(8_np.pi) r_b = 3_m_e*c2/(4_sigma_T_u_b_R_b) r_b = 3_9.1093837015e-28_29979245800.0**2/(4_6.6524587321000005e-25_u_b_R_b1) t_ad = R_b1/29979245800.0
def Q_e(gamma): return 8.8 * gamma**(-2)np.e(-gamma/1.8e4)np.e(r_b/gamma) def Q1(gamma): return si.quad(Q_e,gamma,np.inf)[0] def N(gamma): return np.e**(-r_b/gamma) * r_b*t_ad /gamma**2 * Q1(gamma) gamma_min1 = 1.40e+03 gamma_max = 5.00e+04 Gma = np.logspace(np.log10(gamma_min1), np.log10(gamma_max), 100)
Gma = [1400.0000000000005, 1451.4875266914864, 1504.868600100691, 1560.2128588255935, 1617.5925025492952, 1677.082386228548, 1738.7601177462361, 1802.7061591552008, 1869.0039316454931, 1937.7399243719876, 2009.0038072843165, 2082.8885481063508, 2159.490533617791, 2238.9096953961175, 2321.2496401829276, 2406.617785044728, 2495.12549750451, 2586.8882408269174, 2682.0257246465367, 2780.6620611358153, 2882.9259269163385, 2988.9507309246824, 3098.8747884518402, 3212.8415015832625, 3330.9995462748925, 3453.5030663092894, 3580.5118743848093, 3712.1916606002164, 3848.7142086066915, 3990.2576197092185, 4137.006545209707, 4289.152427294947, 4446.893748783661, 4610.436292058447, 4779.993407520415, 4955.786291916725, 5138.0442769041265, 5327.005128224939, 5522.91535588577, 5726.030535743617, 5936.615642918876, 6154.945397470217, 6381.304622782279, 6615.9886171337175, 6859.303538930317, 7111.566806105801, 7373.107510211271, 7644.266845733555, 7925.398555202518, 8216.869390667984, 8519.05959214832, 8832.363383674818, 9157.189487579002, 9493.9616576938, 9843.119232164136, 10205.117706588084, 10580.429328236447, 10969.5437121257, 11372.968479748195, 11791.229921292812, 12224.873682219963, 12674.465475086636, 13140.591817550094, 13623.860797512973, 14124.902866408, 14644.371661657162, 15182.944859378313, 15741.325058451597, 16320.240697099014, 16920.44700317284, 17542.726979392653, 18187.89242481617, 18856.784993876598, 19550.27729436791, 20269.274025810562, 21014.71315968268, 21787.56716305631, 22588.844267235214, 23419.589783048803, 24280.88746451912, 25173.86092267792, 26099.675091380926, 27059.53774702843, 28054.701084178057, 29086.463349101767, 30156.170533421686, 31265.21813003065, 32415.05295359142, 33607.17502798711, 34843.13954318634, 36124.55888407561, 37453.10473390561, 38830.51025509559, 40258.57235024077, 41739.1540062723, 43274.186724828, 44865.673042004375, 46515.68914077701, 48226.387559497445, 49999.99999999999]
n1 = [400.03038267515564, 364.4407824122864, 331.7536549049479, 301.7577319411341, 274.2549764294827, 249.05987916071075, 225.99879682887925, 204.90932616948302, 185.63970992703895, 168.04827112329076, 152.00287275998733, 137.38040066101476, 124.06626764274444, 111.953937605043, 100.94446846566291, 90.94607312514962, 81.87369785567016, 73.64861766284237, 66.19804828205453, 59.4547745467929, 53.3567949125473, 47.846981941752325, 42.87275855815742, 38.385789867597346, 34.341690320336596, 30.69974596137393, 27.42265148222659, 24.476261752867558, 21.829357478073774, 19.453424589126513, 17.322446951484054, 15.412711941978113, 13.702628426022159, 12.172556646503955, 10.804649521591267, 9.582704838579074, 8.492027825006703, 7.519303576343261, 6.6524788212870245, 5.880652510815274, 5.193974725194965, 4.583553403851673, 4.041368415924141, 3.560192504143148, 3.1335186510214883, 2.755493433901441, 2.4208559538781858, 2.1248819427261334, 1.8633326714552045, 1.6324083037949515, 1.4287053575543402, 1.2491779562674181, 1.0911025726683925, 0.9520459842251976, 0.8298361791012582, 0.7225359684328713, 0.6284190776442038, 0.5459485056288753, 0.4737569559752147, 0.41062915898336444, 0.35548591700781523, 0.30736971865954665, 0.26543177962583914, 0.22892037932750542, 0.19717037335224352, 0.1695937716026891, 0.14567128140525204, 0.12494472347009085, 0.10701023660453353, 0.09151219449209418, 0.07813776469585754, 0.06661204634543931, 0.056693728776638246, 0.04817121872021901, 0.04085918852791465, 0.034595502402685045, 0.029238481697073434, 0.024664474085549424, 0.020765694830302293, 0.01744831146997509, 0.014630746090911651, 0.012242171912762051, 0.010221183255677287, 0.008514620074228674, 0.007076530161901148, 0.005867253866396372, 0.004852617725842891, 0.004003224853869804, 0.0032938311808845986, 0.0027027978122132145, 0.0022116108024919615, 0.0018044605803757767, 0.0014678740979228032, 0.0011903935337989687, 0.0009622960568334191, 0.0007753497638635886, 0.0006226014500065597, 0.0004981923566509282, 0.00039719847819719145, 0.0003154923979911541] * u.Unit("cm-3")
I'm sorry my formatting is so messy
from agnpy.
Hello @422314581,
I wanted to inform you that I am working on the fix, and at the same time, I am adding the analytical solution of the kinetic equation you pointed out (Eq. 8).
As soon as I pone the PR, I will point you to the branch.
from agnpy.
@422314581 why are you closing the issue?
Please do not do it, leave it open until this problem is fixed.
from agnpy.
I'm sorry. I thought I just opened the question by mistake.
from agnpy.
btw, there is also no implement of evaluate_SSA_integrand in InterpolatedDistribution, and it raise exception when I want ssa in my SED
from agnpy.
Thanks a lot @422314581 and @FurenDeng for reporting these issues.
I just opened #145 that should fix them.
@422314581 I am very sorry for the slow fix, I have been meaning for a while to introduce distributions that were actual solutions of the electrons kinetic equation (e.g. Eq. 8) - such that you wouldn't be forced to use the interpolation.
But it took a ling time, and I did not have a final result: I need more work.
I preferred to fix this specific issue for the time being.
from agnpy.
Hi @422314581, @FurenDeng, can you check with the dev version if your issues are fixed?
They should be.
Cheers.
from agnpy.
Related Issues (20)
- Introducing a Particle class HOT 1
- Incompatibility between astropy 5.0.1 and agnpy 0.1.8 ? HOT 1
- bug when simulation of gammapy datasets with an agnpy spectrum model HOT 9
- Absorption calculation stability HOT 1
- Add sherpa and gammapy among the dependencies (add them to install_requires in setup.py) HOT 4
- Add a CITATION.cff file?
- TypeError: __init__() got an unexpected keyword argument 'is_norm' HOT 3
- Bullet points of lists disappear on Read the Docs HOT 1
- Error in the EBL absorption HOT 1
- Discrepancy between AGNpy and LeHa code in proton synchrotron
- Add the synchrotron proton to the models available for fitting
- Issue with fitting MWL SED using agnpy HOT 7
- Return the different SED components after a fit HOT 2
- Problem about load_absorption_table in class EBL HOT 2
- Problem about load_absorption_table in class EBL
- Move the tests to the subdirectory of each module. HOT 1
- Fitting of a MWL BL Lac SED: Fit doesn't converge. HOT 1
- d_L parameter in blob definition spoiling older code and examples
- Logging is silently disabled on agnpy import HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agnpy.