Comments (3)
Hi @jsitarek,
thanks for reporting, very strange that is not matched by the tests.
I just pulled the latest version and executed all the tests, they work.
I will take another look executing your snippet.
from agnpy.
Hi @jsitarek,
to me it works with the latest version of the code.
I have cleaned your snippet, please next time post a more ordered snipppet 😜
import numpy as np
import math
import astropy.units as u
import astropy.constants as const
from astropy.coordinates import Distance
from agnpy.emission_regions import Blob
from agnpy.synchrotron import Synchrotron
from agnpy.utils.plot import plot_sed
import matplotlib.pyplot as plt
z = 0.94 # redshift
delta_D = 15
Gamma = 15
theta = 1. / Gamma
spectrum_norm2 = 2.e-7 * u.Unit("erg cm-3")
B2 = np.sqrt(spectrum_norm2.value * 8 * np.pi) * u.G
gmin2 = 2. # minimum Lorentz factor
xi2 = 3.e-10 # acceleration parameter
dist2 = 100 * 3.e18 * u.cm # distance of the blob
p1_2 = 2.0
p2_2 = p1_2 + 1
radius2 = dist2 * theta
gbreak = 43.e3 # tentative values
gmax = 43.e3 # tentative values
parameters2 = {
"p1": p1_2,
"p2": p2_2,
"gamma_b": gbreak,
"gamma_min": gmin2,
"gamma_max": gmax,
}
spectrum_dict2 = {"type": "BrokenPowerLaw", "parameters": parameters2}
blob2 = Blob(radius2, z, delta_D, Gamma, B2, spectrum_norm2, spectrum_dict2, xi=xi2)
nu = np.logspace(8, 28, 100) * u.Hz
synch2 = Synchrotron(blob2, ssa=True)
# let us compute synchrotron SED
synch_sed2 = synch2.sed_flux(nu)
# let us plot it
plot_sed(nu, synch_sed2)
plt.show()
Can you try:
cd agnpy
git pull origin master
python -m pip install .
this will install the development agnpy
version in your miniconda base environment
In [1]: import agnpy
In [2]: agnpy.__file__
Out[2]: '/home/cosimo/software/miniconda3/lib/python3.7/site-packages/agnpy/__init__.py'
you can un-install it any moment with pip
cosimo@posimo:~$ pip uninstall agnpy
Found existing installation: agnpy 0.0.8
Uninstalling agnpy-0.0.8:
Would remove:
/home/cosimo/software/miniconda3/lib/python3.7/site-packages/agnpy-0.0.8.dist-info/*
/home/cosimo/software/miniconda3/lib/python3.7/site-packages/agnpy/*
Proceed (y/n)? y
Successfully uninstalled agnpy-0.0.8
I recommend you stop using sys.path.append
.
from agnpy.
Hi @cosimoNigro,
Thx for checking and sorry for a messy code example.
I checked the snippet again and mysteriously it works now, I have no idea what happened here, I will check again my on laptop at home, maybe I screwed up something with the code there.
I checked also the other issue #75 since it was reporting also a similarly looking problem, but it seems to be something else there.
About sys.path.append I'm using two versions of agnpy, the current one, and some older one which had some differences in API, and also having both was good for tests, and this was the simplest way to switch between them.
Installing it via pip is convenient for the user, but then if I install it via pip I guess I would have to reinstall it after every modification of the code, or modify directly the installed code and then for commits move those files back to git directory. Or does it just install links to git directory?
Let me close the issue now, if I find out what happened that caused the original problem I will let you know, and sorry again for wasting your time on checking it.
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
- Error in InterpolatedDistribution HOT 11
- 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.