Skip to main content

Synchtrotron peak estimator for blazars

Project description

BlaST

BlaST (Blazar Synchrotron Tool) is a tool to estimate the synchrotron peak of blazars given its spectral energy distribution. The package is available on pip and can simply be installed via

pip install astroblast

Running the tool is as simple as typing

blast sed.txt

where sed.txt is a output file generated by the VOUBlazar tool and might look something like the following:

   1  matched source  227.16230  -49.88400  99
 Frequency     nufnu     nufnu unc.  nufnu unc. start time   end time   Catalog     Reference
    Hz       erg/cm2/s     upper       lower        MJD         MJD   
---------------------------------------------------------------------------------------------------------------------------
 2.418E+17   2.185E-13   3.139E-13   1.230E-13  55000.0000  55000.0000  RASS        Boller et al. 2016, A&A, 103, 1                                                                                                                                                                         
 2.418E+17   5.085E-13   6.281E-13   3.889E-13  58150.0000  58150.1016  OUSXB       Giommi et al. 2019, Accepted for publication in A&A  

This gives the following output:

12.42 (+/- 0.71)

The first value is the synchrotron peak and the second the 95% prediction interval both in log10. It is possible to specify a different prediction interval width by the -w argument, followed by the width in sigmas:

blast sed.txt -w 1.0

BlaST also supports bulk estimation, e.g. estimating a whole catalogue, by providing a directory or zip file containing the seds as well as an output file in which the results will be written to as csv:

blast seds.zip -o estimates.csv

With V2 you now also have the option to estimate the synchrotron peak flux (erg/cm2/s), again in log10. You enable this with the -f flag:

-12.39 (+/- 0.63) @ 12.39 (+/- 0.39)

Changes from v1 to v2

With v2 there has been some major changes. Some are listed in the following:

  • New data set (courtesy of N. Krieger)
    The data set has been refined resulting in a new set independent of the previous one. This one now also includes labels for the flux.
  • Flux estimate
    Biggest difference is the estimation of the synchrotron peak's flux by an independent ensemble of neural networks.
  • Save models in ONNX format
    Previously, the tool needed pytorch installed, which is quite large. We moved to ONNX runtime to make the installation slimmer.

How it works

BlaST consists of an ensemble of similar neural networks power by pytorch based on the method presented in Lakshminarayanan et. al. 2016. The data set (see SEDs.zip) is based on the three catalogues 4LAC, 3HSP and 5BZCat and divided into 5 bags. For each bag an ensemble of 5 models are trained totalling 25 independent models.

The bagging allows the reapply the ensemble on the training data as an out-of-bag estimation, i.e. excluding the ensemble members that were trained on a training set without that specific bag. The results are shown in estimates.csv.

For specific details, e.g. how the data was enhanced and how the bias in the data set was handles, take a look in BlaST.ipynb which is the notebook used to train the models. Note that if you want to run that notebook you'll also need to install PyTorch Lightning

Performance

The performance was evaluated using out-of-bag estimates on the training data including a 95% prediction interval. Metrics are shown as median and 25%/75% quantile. Since the model for predicting the peak frequency and peak flux are independent, metrics are shown for both.

Metric Value Freq Flux
Abs Err Median 0.163 0.104
25% 0.075 0.049
75% 0.314 0.186
PI Width Median 1.267 1.087
25% 1.009 0.971
75% 1.625 1.198
Interval Median 1.400 1.088
Score 25% 1.010 0.972
75% 1.636 1.199

Peak Frequency Estimate

The following show the prediction histogram with the median as black line, as well as the 90% and 10% quantile shown as dotted lines

Prediction Histogram: Peak Frequency

The next shows the prediction interval (95%) widths. The percentages above and below show the respective amount of samples outside their intervals.

Prediction Intervals: Peak Frequency

The final one shows the prediction error and the prediction interval distribution using a moving window and smoothed using cubic splines.

Error Distribution: Peak Frequency

Peak Flux Estimate

Same plots, but now for the peak flux estimate.

Prediction Histogram: Peak Flux Prediction Intervals: Peak Flux Error Distribution: Peak Flux

Use BlaST in code

BlaST can also be imported as python package:

from blast import *

sed, pos = parse_sed('sed.txt', position=True) #reads the file
bag = get_bag(pos) #Returns bag if sed was part of training
bins = bin_data(sed)

# estimate peak frequency
estimator = PeakFrequencyEstimator()
peak, err = estimator(bins, bag)
# estimate peak flux
estimator = PeakFluxEstimator()
peak, err = estimator(bins, bag)

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astroblast-2.0.1.tar.gz (11.0 MB view details)

Uploaded Source

Built Distribution

astroblast-2.0.1-py3-none-any.whl (11.0 MB view details)

Uploaded Python 3

File details

Details for the file astroblast-2.0.1.tar.gz.

File metadata

  • Download URL: astroblast-2.0.1.tar.gz
  • Upload date:
  • Size: 11.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for astroblast-2.0.1.tar.gz
Algorithm Hash digest
SHA256 7a35713c8c24ab2ade980bb502e45d032f3751d9dd2c04c3674a012475a3f509
MD5 6ee17842da879ad963e059ec66e0ed57
BLAKE2b-256 336c7904b020017f912ab0783fa3c32be78de25acee49896fb3f13aa7a209cc4

See more details on using hashes here.

File details

Details for the file astroblast-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: astroblast-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for astroblast-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e11645f0ae6613f6fbc5c510eb961aabcdc41fde26e84c5edd83e1a4aebcf587
MD5 d7e6636a965d364dd758bcfa90541038
BLAKE2b-256 ee4288a5122b10fff2c5238c8fa0843661c12000c7d71b1853c2c11bc5d5e8e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page