from wtlike import *
from utilities.ipynb_docgen import *
source_name = '4FGL J1257.0-6339'

def P88Y3250( clear=False):
    r"""
    ## Variability analysis of 4FGL J1257.0-6339
    {date}
    
    This source, ~$0.5^\circ$ distant from PSR B1259-63, has a nickname P88Y3250. 
    I look at it because it was flagged as variable, index=48.3, so may affect B1259.
    
    
    It is unassociated, with a pointlike TS=287, and flux uncertainty of 0.7%. Its 12-year SED is:
    
    {sed}
    
    {out1}
    
    {out2}
    
    Here is the light curve, measured in weekly intervals.
    {fig1}
    
    Note that most of the weeks are limits, except for a few quite significant ones.
    The blue line is the result of the Bayesian block (BB) analysis, which found several blocks. 
    
    The BB fluxes with relative flux >2:
    {bbflux}
    Here is a an expansion, in daily bins, following the 2017 B1259-63 periastron at 58018:
    
    {fig2}

    ### Comparison with the [LightCurveRepository](https://fermi.gsfc.nasa.gov/ssc/data/access/lat/LightCurveRepository/).
    
    {lc_image}
    This shows the energy flux for 3-day intervals, and appears to be consistent with the wtlike analysis.
    
    ### Conclusion
    
    This source is not variable--the apparent variability is entirely due to the flares from B1259-63.
    
    """
   
    sed = image('P88Y3250_sed_uw1216.jpg', width=250, caption=None)
    
    with capture_print('Output: load data, add weights, form time bins, fit') as out1:
        weekly = WtLike(source_name)
        
    with capture_print('BB partition output') as out2:
        bbview = weekly.bb_view()
        
    fig1 =figure(
            bbview.plot( yscale='log', ylim=(0.5, 200), ts_bar_min=4, figsize=(20,4)),
            width=600, )
    bbflux = monospace(bbview.fluxes.query('flux>2'))
    
    with capture_print() as out3:
        fig2 = figure(
                weekly.view((58050, 58100,1)).plot( fignum=2),
                width=600)
    
    lc_image=image('P88Y3250_light_curve.png', width=600, caption=None)

    return locals()

# runs the above, generates the doc
nbdoc(P88Y3250, clear=False)

Variability analysis of 4FGL J1257.0-6339

2021-05-21 08:59

This source, ~$0.5^\circ$ distant from PSR B1259-63, has a nickname P88Y3250. I look at it because it was flagged as variable, index=48.3, so may affect B1259.

It is unassociated, with a pointlike TS=287, and flux uncertainty of 0.7%. Its 12-year SED is:

Figure 1 at images/P88Y3250_fig_01.png

Output: load data, add weights, form time bins, fit
SourceData: photons and exposure for 4FGL J1257.0-6339: Restoring from cache with key "4FGL J1257.0-6339_data"
SourceData: Source 4FGL J1257.0-6339 with:
data: 1,333,593 photons from 2008-08-04 to 2021-05-19
exposure: 3,356,508 intervals, average rate 3578 cm^2 for 100.2 Ms
rates: source 7.57e-09/s, background 3.71e-06/s, S/N ratio 2.04e-03
CellData: Bin photon data into 667 1-week bins from 54683.0 to 59352.0
LightCurve: select 660 cells for fitting with e>1 & n>2

BB partition output
LightCurve: select 660 cells for fitting with e>1 & n>2
Bayesian Blocks: using penalty 0.05
Partitioned 660 cells into 9 blocks, using LikelihoodFitness
LightCurve: Loaded 9 / 9 cells for fitting

Here is the light curve, measured in weekly intervals.

Figure 2 at images/P88Y3250_fig_02.png

Note that most of the weeks are limits, except for a few quite significant ones. The blue line is the result of the Bayesian block (BB) analysis, which found several blocks.

The BB fluxes with relative flux >2:

         t     tw      n    ts   flux           errors  limit
1 55589.5 21.0 6199 41.2 13.21 (-2.506, 2.527) 17.40
3 56758.5 231.0 63904 56.3 3.59 (-0.522, 0.523) 4.45
5 57976.5 161.0 47067 25.6 2.60 (-0.544, 0.559) 3.54
6 58074.5 35.0 12436 52.0 10.21 (-1.66, 1.67) 12.97
8 59331.0 42.0 10859 45.4 9.85 (-1.723, 1.734) 12.72
Here is a an expansion, in daily bins, following the 2017 B1259-63 periastron at 58018:

Figure 3 at images/P88Y3250_fig_03.png

Comparison with the LightCurveRepository.

Figure 4 at images/P88Y3250_fig_04.png
This shows the energy flux for 3-day intervals, and appears to be consistent with the wtlike analysis.

Conclusion

This source is not variable--the apparent variability is entirely due to the flares from B1259-63.

Implications for the Catalog

This could be done with all 4FGL sources with a relatively small amount of effort.

Computing times to generate this:

  • 15' using pointlike to generate a table of weights for energy- and angle- regions
  • 10' to load photons in the source region from the compressed FT1/FT2 table for the 11 2/3 years, and apply weights using the associated table.

What would be needed:

  1. a systematic effort to produce such tables, using the official catalog model with fermipy for all sources.
  2. Compare all lightcurves for nearby sources to check correlations: for such pairs, or groups, identify which is the culpit, and modify the background assumption for the neighbors.
  3. A modification of wtlike to change the current background assumption, allowing it to have a fixed and a variable component

Potential result: Detailed, and more reliable, light curves on any time scale for all sources.

Can I enlist volunteer(s)? This especially applies to #1.