abatten / fruitbat Goto Github PK
View Code? Open in Web Editor NEWA fast radio burst (FRB) redshift estimation package written in Python.
Home Page: https://fruitbat.readthedocs.io
License: BSD 3-Clause "New" or "Revised" License
A fast radio burst (FRB) redshift estimation package written in Python.
Home Page: https://fruitbat.readthedocs.io
License: BSD 3-Clause "New" or "Revised" License
I use pip to install the content in Figure 1, and finally I download it to the local installation C:\Users\61006\Desktop\fruitbat-2.0.1\fruitbat-2.0.1> python setup.py install and it appears File "C:\Users\61006\AppData\Local\Temp\easy_install-68ezzisq\pygedm-3.3.0\setup.py", line 143, in UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 7568: illegal multibyte sequence。I have not been able to solve through many methods
Add a check for to determine if the arguments passed in Frb
have existing units. This check would be done in the setter functions of each variable. This would resolve issue #14.
I have built a script to compute the redshift for all FRBs using fruitbat, based on the burst's galactic coordinates and DM. I am trying to verify the estimated redshift is about right and I haven't messed anything up with the code. Is there perhaps some catalogue I could refer to, to cross-check my derived redshifts?
E.g., for FRB 20190214A
(arbitrary selection) with:
l=148.5
b=22.03
DM=498.2
I get a redshift of z=1.215
. Does this look right?
It would be handy to have a link back to the github repo on the main page of the sphinx docs:
When I run the "simple example" here:
https://fruitbat.readthedocs.io/en/latest/user_guide/getting_started.html#simple-example
I get an UnpicklingError
:
FRB180110.calc_redshift(method="Zhang2018", cosmology="Planck18")
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
/usr/lib64/python3.7/site-packages/numpy/lib/npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
439 try:
--> 440 return pickle.load(fid, **pickle_kwargs)
441 except Exception:
UnpicklingError: invalid load key, 'v'.
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
<ipython-input-5-9a85f326ef82> in <module>
----> 1 FRB180110.calc_redshift(method="Zhang2018", cosmology="Planck18")
~/.local/lib/python3.7/site-packages/fruitbat/_frb.py in calc_redshift(self, method, cosmology, subtract_host, lookup_table)
306 table_name = "".join(["custom_", method, ".npz"])
307
--> 308 lookup_table = table.load(table_name)
309
310 self.z = table.get_z_from_table(input_dm, lookup_table)
~/.local/lib/python3.7/site-packages/fruitbat/table.py in load(name, data_dir)
138
139 filename = os.path.join(data_dir, name)
--> 140 return np.load(filename)
141
142
/usr/lib64/python3.7/site-packages/numpy/lib/npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
441 except Exception:
442 raise IOError(
--> 443 "Failed to interpret file %s as a pickle" % repr(file))
444 finally:
445 if own_fid:
OSError: Failed to interpret file '/home/zingale/.local/lib/python3.7/site-packages/fruitbat/data/Zhang2018_Planck18.npz' as a pickle
I am using python 3.7.3
Currently, in calc_redshift, if subtract_host is True, the function just takes self.dm_excess - self.dm_host_est as the new input DM. However, one must consider the cosmological effect in the host galaxy DM (eg. http://doi.org/10.1086/380598, http://arxiv.org/abs/2107.10858). The new input DM should be DM_{excess}-DM_{host}/(1+z). This 1+z factor needs to be carried to the later solving process.
In the README.md
, please consider addingpybind11
to the list of dependencies.
Working through:
https://fruitbat.readthedocs.io/en/latest/user_guide/using_fruitbat.html
when I get to "Calculating Distances" and the first subsection, "Comoving Distance", I get
In [22]: frb.calc_comoving_distance()
Out[22]: <Quantity 1812.21526231 Mpc>
instead of the 2020.297 value reported. Once I create the next frb
object in the code block below this, if I go back and look at calc_comoving_distance()
I get the value in the docs. So perhaps the docs were executed out of order?
Hello Adam,
Thanks for making your code available online for us. I'm hoping to compare some work to previous literature, including your mean DM - z relationship in Figure 2 (right) of Batten et al. 2021. Adapting the examples you provide in the documentation, I've tried to plot the actual EAGLE curve via the code below, and have included the resulting plot in an attachment.
As can be seen, this doesn't look quite the same as in the paper, as it blows up approaching redshift 3. I was wondering whether you had any advice on what was going on here?
Many thanks,
Charlie
import fruitbat
from matplotlib import pyplot as plt
fb_dm_vals = np.linspace(.01,5000,20)
fb_batten_z_vals = [fruitbat.Frb(i).calc_redshift(method="Batten2021", cosmology="Planck18") for i in fb_dm_vals]
plt.ylabel('DM')
plt.xlabel('z')
plt.plot(fb_batten_z_vals,fb_dm_vals)
plt.show()
Hey, was playing with luminosity conversion and I'm getting a unit error:
frb = fruitbat.Frb(name='FRB170922', gl=45.07, gb=-38.70, fluence=177, dm=1111,
obs_bandwidth=31.25)
frb.calc_dm_galaxy()
frb.calc_redshift()
print(frb.calc_energy())
>>> 1.7065900447006508e+41 erg
But with units on obs_bandwidth:
from astropy import units as u
frb = fruitbat.Frb(name='FRB170922', gl=45.07, gb=-38.70, fluence=177, dm=1111,
obs_bandwidth=31.25*u.MHz)
frb.calc_dm_galaxy()
frb.calc_redshift()
print(frb.calc_energy())
>>> [traceback here]
UnitConversionError: 'Jy MHz2 Mpc2 ms' (power) and 'erg' (energy) are not convertible
Also - smallish feature request: compute average luminosity in ergs/s
Does fruitbat.Frb
support the more up-to-date TNS designation for the name
parameter (e.g. FRB 20180110
) or only the older-ish one (e.g. FRB180110
)? If not, it might be worth adding a simple automatic parser between the two designation to support both 'standards'. Otherwise, I can simply do the parsing before passing it to fruitbat.Frb()
.
When I execute the "Custom Cosmologies" part of these docs:
https://fruitbat.readthedocs.io/en/latest/user_guide/using_fruitbat.html
I get:
params = {"H0": 72.4, "Om0": 0.26}
In [38]: new_cosmology = fruitbat.cosmology.create_cosmology(parameters=params)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-38-f71389f8752f> in <module>
----> 1 new_cosmology = fruitbat.cosmology.create_cosmology(parameters=params)
AttributeError: module 'fruitbat' has no attribute 'cosmology'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.