Exemple #1
0
    def build_each_psr(self,psr):
        filename=join(self.webdir,'%s.t2t' % psr)

        get_sed_table = lambda *args: '|| ' + ' | '.join(['[%s/fits/%s/seds/%s]' % (self.relpath,psr,i) for i in args]) + ' |\n\n'

        get_plot_table = lambda *args: '|| ' + ' | '.join(['[%s/fits/%s/plots/%s]' % (self.relpath,psr,i) for i in args]) + ' |\n\n'

        website = [
            '%s+' % psr,
            '',
            '',
            self.summary_table([psr]),
            '',
            'SEDs',
            get_sed_table(*['sed_pointlike_4bpd_%s_%s.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_sed_table(*['sed_gtlike_2bpd_%s_%s.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_sed_table(*['sed_gtlike_4bpd_%s_%s.png' % (i,psr) for i in self.loader.all_hypotheses]),
            'TS Maps',
            get_plot_table(*['tsmap_source_%s_%s_5.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_plot_table(*['tsmap_source_%s_%s_10.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_plot_table(*['tsmap_residual_%s_%s_5.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_plot_table(*['tsmap_residual_%s_%s_10.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            'Plots',
            get_plot_table(*['source_%s_%s_5.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_plot_table(*['source_%s_%s_10.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_plot_table(*['sources_%s_%s_5.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            get_plot_table(*['sources_%s_%s_10.0deg.png' % (i,psr) for i in self.loader.all_hypotheses]),
            '```',
            yaml.dump(self.loader.get_results(psr,require_all_exists=False)),
            '```',
        ]

        t2t(website,filename)
Exemple #2
0
    def build_main(self):
        psr_list = self.loader.get_psr_list()

        filename = join(self.webdir, 'index.t2t')

        website = ['Gamma Quiet PSRs', '', '', self.summary_table(psr_list)]

        t2t(website, filename)
Exemple #3
0
    def build_main_website(self):
        print 'Building Main Webpage'

        index_t2t = []
        index_t2t.append('PWNCatalog+\n\n')
        t = self.formatter.format(self.pwnlist)
        index_t2t.append(str(t))
        t2t(index_t2t, join(self.webdir, 'index.t2t'))
Exemple #4
0
    def build_main_website(self):
        print 'Building Main Webpage'

        index_t2t = []
        index_t2t.append('PWNCatalog+\n\n')
        t=self.formatter.format(self.pwnlist)
        index_t2t.append(str(t))
        t2t(index_t2t, join(self.webdir,'index.t2t'))
Exemple #5
0
    def build_main(self):
        psr_list = self.loader.get_psr_list()


        filename=join(self.webdir,'index.t2t')

        website=[
            'Gamma Quiet PSRs',
            '',
            '',
            self.summary_table(psr_list)
        ]

        t2t(website,filename)
Exemple #6
0
analysis_path=expandvars('$pwncat2_off_peak_results/%s/analysis' % version)


if not exists(website_path): os.makedirs(website_path)

website=expandvars(join(website_path,'index.t2t'))


pwnlist=sorted(yaml.load(open(expandvars('$pwndata/pwncat2_data_lande.yaml'))).keys())

lines = ['Off Peak', '', '']

for pwn in pwnlist:

    temp='%s/%s/results_%s.yaml' % (analysis_path,pwn,pwn)
    if os.path.exists(temp):
        r=yaml.load(open(temp))
        off_peak=r['off_peak_phase']

        lines.append('==%s==' % pwn)
        lines.append('[../analysis/%s/results_%s.png]' % (pwn,pwn))
        lines.append('')
        lines.append('[results ../analysis/%s]' % pwn)
        lines.append('')
        lines.append('Off Peak: """%s"""' % str(off_peak))
        lines.append('===')
    else:
        print 'SKIPPING %s' % pwn

t2t(lines,website)
Exemple #7
0
    def build_each_psr(self, psr):
        filename = join(self.webdir, '%s.t2t' % psr)

        get_sed_table = lambda *args: '|| ' + ' | '.join(
            ['[%s/fits/%s/seds/%s]' % (self.relpath, psr, i)
             for i in args]) + ' |\n\n'

        get_plot_table = lambda *args: '|| ' + ' | '.join(
            ['[%s/fits/%s/plots/%s]' % (self.relpath, psr, i)
             for i in args]) + ' |\n\n'

        website = [
            '%s+' % psr,
            '',
            '',
            self.summary_table([psr]),
            '',
            'SEDs',
            get_sed_table(*[
                'sed_pointlike_4bpd_%s_%s.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_sed_table(*[
                'sed_gtlike_2bpd_%s_%s.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_sed_table(*[
                'sed_gtlike_4bpd_%s_%s.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            'TS Maps',
            get_plot_table(*[
                'tsmap_source_%s_%s_5.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_plot_table(*[
                'tsmap_source_%s_%s_10.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_plot_table(*[
                'tsmap_residual_%s_%s_5.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_plot_table(*[
                'tsmap_residual_%s_%s_10.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            'Plots',
            get_plot_table(*[
                'source_%s_%s_5.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_plot_table(*[
                'source_%s_%s_10.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_plot_table(*[
                'sources_%s_%s_5.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            get_plot_table(*[
                'sources_%s_%s_10.0deg.png' % (i, psr)
                for i in self.loader.all_hypotheses
            ]),
            '```',
            yaml.dump(self.loader.get_results(psr, require_all_exists=False)),
            '```',
        ]

        t2t(website, filename)
Exemple #8
0
    def build_each_page(self, pwn):
        print 'Building webpage for %s' % pwn
        index_t2t = []
        index_t2t.append(pwn + '\n\n')
        index_t2t.append('([back index.html])')
        t = self.formatter.format([pwn])
        index_t2t.append(str(t))
        index_t2t.append('')
        index_t2t.append('[Analysis Folder %s/%s]\n' % (self.relpath, pwn))
        index_t2t.append('[log (pointlike) %s/%s/log_run_%s.txt]\n' %
                         (self.relpath, pwn, pwn))

        index_t2t.append(
            'pointlike results: [(at_pulsar) %s/%s/results_%s_pointlike_at_pulsar.yaml] [(point) %s/%s/results_%s_pointlike_point.yaml] [(extended) %s/%s/results_%s_pointlike_extended.yaml] \n'
            % (self.relpath, pwn, pwn, self.relpath, pwn, pwn, self.relpath,
               pwn, pwn))
        index_t2t.append(
            'gtlike results: [(at_pulsar) %s/%s/results_%s_gtlike_at_pulsar.yaml] [(point) %s/%s/results_%s_gtlike_point.yaml] [(extended) %s/%s/results_%s_gtlike_extended.yaml] \n'
            % (self.relpath, pwn, pwn, self.relpath, pwn, pwn, self.relpath,
               pwn, pwn))

        get_plot_table = lambda *args: index_t2t.append('|| ' + ' | '.join(
            ['[%s/%s/plots/%s]' % (self.relpath, pwn, i)
             for i in args]) + ' |\n\n')
        get_sed_table = lambda *args: index_t2t.append('|| ' + ' | '.join(
            ['[%s/%s/seds/%s]' % (self.relpath, pwn, i)
             for i in args]) + ' |\n\n')

        title = lambda i: index_t2t.append('\n\n== %s ==' % i)

        title('Phase Info')
        get_plot_table('phaseogram_%s.png' % (pwn),
                       'phase_vs_time_%s.png' % (pwn))

        all = ['at_pulsar', 'point', 'extended']

        title('Big Residual TS map')
        get_plot_table(
            *['tsmap_residual_%s_%s_10deg.png' % (i, pwn) for i in all])

        index_t2t.append(
            '[tsmap_residual_%s_%s_10deg.fits %s/%s/data/tsmap_residual_%s_%s_10deg.fits]'
            % (pwn, 'at_pulsar', self.relpath, pwn, 'at_pulsar', pwn))

        title('SED gtlike (4bpd)')
        get_sed_table(*['sed_gtlike_4bpd_%s_%s.png' % (i, pwn) for i in all])

        title('Combined gtlike')
        get_plot_table(
            *['combined_gtlike_spectra_%s_%s.png' % (i, pwn) for i in all])

        title('Combined pointlike')
        get_plot_table(
            *['combined_pointlike_spectra_%s_%s.png' % (i, pwn) for i in all])

        title('gtlike Cutoff test')
        get_plot_table(*[
            'test_cutoff_gtlike_%s_%s.png' % (i, pwn)
            for i in ['at_pulsar', 'point']
        ])

        title('pointlike Cutoff test')
        get_plot_table(*[
            'test_cutoff_pointlike_%s_%s.png' % (i, pwn)
            for i in ['at_pulsar', 'point']
        ])

        title('Source TS Maps')
        get_plot_table(
            *['tsmap_source_%s_%s_5deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_tsmap_source_%s_%s_5deg.png' % (i, pwn) for i in all])

        title('Residual TS Maps')
        get_plot_table(
            *['tsmap_residual_%s_%s_5deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_tsmap_residual_%s_%s_5deg.png' % (i, pwn) for i in all])

        title('New Source TS Maps')
        get_plot_table(
            *['tsmap_newsrc_%s_%s_5deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_tsmap_newsrc_%s_%s_5deg.png' % (i, pwn) for i in all])

        title('at_pulsar Smoothed Counts Diffuse Subtracted (0.1)')
        get_plot_table(
            *['sources_%s_%s_5deg_0.1deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_sources_%s_%s_5deg_0.1deg.png' % (i, pwn) for i in all])

        title('Smoothed Counts BG Source Subtracted (0.1)')
        get_plot_table(
            *['source_%s_%s_5deg_0.1deg.png' % (i, pwn) for i in all])

        title('Band Smoothed Counts BG Source Subtracted (0.1)')
        get_plot_table(
            *['band_source_%s_%s_5deg_0.1deg.png' % (i, pwn) for i in all])

        title('gtlike SED')
        get_sed_table(*['sed_gtlike_1bpd_%s_%s.png' % (i, pwn) for i in all])
        get_sed_table(*['sed_gtlike_2bpd_%s_%s.png' % (i, pwn) for i in all])

        title('Pointlike SEDs')
        get_sed_table(
            *['sed_pointlike_4bpd_%s_%s.png' % (i, pwn) for i in all])

        title('Extra: Source TS Maps (10 deg)')
        get_plot_table(
            *['tsmap_source_%s_%s_10deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_tsmap_source_%s_%s_10deg.png' % (i, pwn) for i in all])

        title('Extra: Residual TS Maps')
        get_plot_table(
            *['tsmap_residual_%s_%s_10deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_tsmap_residual_%s_%s_10deg.png' % (i, pwn) for i in all])

        title('Extra: New Source TS Maps (10 deg)')
        get_plot_table(
            *['tsmap_newsrc_%s_%s_10deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_tsmap_newsrc_%s_%s_10deg.png' % (i, pwn) for i in all])

        title('Extra: Smoothed Counts (0.25deg)')
        get_plot_table(*['source_0.25_%s_%s_5deg.png' % (i, pwn) for i in all])

        title('Extra: Smoothed Counts (0.25deg)')
        get_plot_table(
            *['sources_0.25_%s_%s_5deg.png' % (i, pwn) for i in all])

        title('Extra: Band Smoothed Counts (0.25)')
        get_plot_table(
            *['band_source_%s_%s_5deg_0.25deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *['band_sources_%s_%s_5deg_0.25deg.png' % (i, pwn) for i in all])

        title('Counts (0.1)')
        get_plot_table(
            *['counts_residual_%s_%s_5deg_0.1deg.png' % (i, pwn) for i in all])

        get_plot_table(
            *['counts_source_%s_%s_5deg_0.1deg.png' % (i, pwn) for i in all])

        title('Extra: Counts (0.25)')
        get_plot_table(
            *['counts_source_%s_%s_5deg_0.25deg.png' % (i, pwn) for i in all])
        get_plot_table(
            *
            ['counts_residual_%s_%s_5deg_0.25deg.png' % (i, pwn) for i in all])

        t2t(index_t2t, join(self.webdir, '%s.t2t' % pwn))
Exemple #9
0
    def build_each_page(self,pwn):
        print 'Building webpage for %s' % pwn
        index_t2t = []
        index_t2t.append(pwn+'\n\n')
        index_t2t.append('([back index.html])')
        t=self.formatter.format([pwn])
        index_t2t.append(str(t))
        index_t2t.append('')
        index_t2t.append('[Analysis Folder %s/%s]\n' % (self.relpath,pwn))
        index_t2t.append('[log (pointlike) %s/%s/log_run_%s.txt]\n' % (self.relpath,pwn,pwn))

        index_t2t.append('pointlike results: [(at_pulsar) %s/%s/results_%s_pointlike_at_pulsar.yaml] [(point) %s/%s/results_%s_pointlike_point.yaml] [(extended) %s/%s/results_%s_pointlike_extended.yaml] \n' % (self.relpath,pwn,pwn,self.relpath,pwn,pwn,self.relpath,pwn,pwn))
        index_t2t.append('gtlike results: [(at_pulsar) %s/%s/results_%s_gtlike_at_pulsar.yaml] [(point) %s/%s/results_%s_gtlike_point.yaml] [(extended) %s/%s/results_%s_gtlike_extended.yaml] \n' % (self.relpath,pwn,pwn,self.relpath,pwn,pwn,self.relpath,pwn,pwn))

        get_plot_table = lambda *args: index_t2t.append('|| ' + ' | '.join(['[%s/%s/plots/%s]' % (self.relpath,pwn,i) for i in args]) + ' |\n\n')
        get_sed_table = lambda *args: index_t2t.append('|| ' + ' | '.join(['[%s/%s/seds/%s]' % (self.relpath,pwn,i) for i in args]) + ' |\n\n')

        title = lambda i: index_t2t.append('\n\n== %s ==' % i)

        title('Phase Info')
        get_plot_table('phaseogram_%s.png' % (pwn),'phase_vs_time_%s.png' % (pwn))

        all = ['at_pulsar', 'point', 'extended']

        title('Big Residual TS map')
        get_plot_table(*['tsmap_residual_%s_%s_10deg.png' % (i,pwn) for i in all])

        index_t2t.append('[tsmap_residual_%s_%s_10deg.fits %s/%s/data/tsmap_residual_%s_%s_10deg.fits]' % (pwn,'at_pulsar',self.relpath,pwn,'at_pulsar',pwn))

        title('SED gtlike (4bpd)')
        get_sed_table(*['sed_gtlike_4bpd_%s_%s.png' % (i,pwn) for i in all])

        title('Combined gtlike')
        get_plot_table(*['combined_gtlike_spectra_%s_%s.png' % (i,pwn) for i in all])

        title('Combined pointlike')
        get_plot_table(*['combined_pointlike_spectra_%s_%s.png' % (i,pwn) for i in all])

        title('gtlike Cutoff test')
        get_plot_table(*['test_cutoff_gtlike_%s_%s.png' % (i,pwn) for i in ['at_pulsar', 'point']])

        title('pointlike Cutoff test')
        get_plot_table(*['test_cutoff_pointlike_%s_%s.png' % (i,pwn) for i in ['at_pulsar', 'point']])

                
        title('Source TS Maps')
        get_plot_table(*['tsmap_source_%s_%s_5deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_tsmap_source_%s_%s_5deg.png' % (i,pwn) for i in all])

        title('Residual TS Maps')
        get_plot_table(*['tsmap_residual_%s_%s_5deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_tsmap_residual_%s_%s_5deg.png' % (i,pwn) for i in all])

        title('New Source TS Maps')
        get_plot_table(*['tsmap_newsrc_%s_%s_5deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_tsmap_newsrc_%s_%s_5deg.png' % (i,pwn) for i in all])

        title('at_pulsar Smoothed Counts Diffuse Subtracted (0.1)')
        get_plot_table(*['sources_%s_%s_5deg_0.1deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_sources_%s_%s_5deg_0.1deg.png' % (i,pwn) for i in all])

        title('Smoothed Counts BG Source Subtracted (0.1)')
        get_plot_table(*['source_%s_%s_5deg_0.1deg.png' % (i,pwn) for i in all])



        title('Band Smoothed Counts BG Source Subtracted (0.1)')
        get_plot_table(*['band_source_%s_%s_5deg_0.1deg.png' % (i,pwn) for i in all])

        title('gtlike SED')
        get_sed_table(*['sed_gtlike_1bpd_%s_%s.png' % (i,pwn) for i in all])
        get_sed_table(*['sed_gtlike_2bpd_%s_%s.png' % (i,pwn) for i in all])



        title('Pointlike SEDs')
        get_sed_table(*['sed_pointlike_4bpd_%s_%s.png' % (i,pwn) for i in all])

        title('Extra: Source TS Maps (10 deg)')
        get_plot_table(*['tsmap_source_%s_%s_10deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_tsmap_source_%s_%s_10deg.png' % (i,pwn) for i in all])

        title('Extra: Residual TS Maps')
        get_plot_table(*['tsmap_residual_%s_%s_10deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_tsmap_residual_%s_%s_10deg.png' % (i,pwn) for i in all])

        title('Extra: New Source TS Maps (10 deg)')
        get_plot_table(*['tsmap_newsrc_%s_%s_10deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_tsmap_newsrc_%s_%s_10deg.png' % (i,pwn) for i in all])


        title('Extra: Smoothed Counts (0.25deg)')
        get_plot_table(*['source_0.25_%s_%s_5deg.png' % (i,pwn) for i in all])

        title('Extra: Smoothed Counts (0.25deg)')
        get_plot_table(*['sources_0.25_%s_%s_5deg.png' % (i,pwn) for i in all])


        title('Extra: Band Smoothed Counts (0.25)')
        get_plot_table(*['band_source_%s_%s_5deg_0.25deg.png' % (i,pwn) for i in all])
        get_plot_table(*['band_sources_%s_%s_5deg_0.25deg.png' % (i,pwn) for i in all])

        title('Counts (0.1)')
        get_plot_table(*['counts_residual_%s_%s_5deg_0.1deg.png' % (i,pwn) for i in all])

        get_plot_table(*['counts_source_%s_%s_5deg_0.1deg.png' % (i,pwn) for i in all])


        title('Extra: Counts (0.25)')
        get_plot_table(*['counts_source_%s_%s_5deg_0.25deg.png' % (i,pwn) for i in all])
        get_plot_table(*['counts_residual_%s_%s_5deg_0.25deg.png' % (i,pwn) for i in all])


        t2t(index_t2t, join(self.webdir,'%s.t2t' % pwn))