Giter Club home page Giter Club logo

fruitbat's People

Contributors

abatten avatar telegraphic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fruitbat's Issues

#question

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

Redshift cross-check/verification

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?

unpickling error when doing the "simple example"

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

update dependencies

In the README.md, please consider addingpybind11 to the list of dependencies.

comoving distance differs from docs

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?

Batten2021 curve out past redshift 3

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()

Screenshot 2022-08-08 at 15 35 02

Luminosity unit conversion obs_bandwidth

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

Expected FRB designation (`name`)

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().

no cosmology

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'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.