コード例 #1
0
ファイル: tools.py プロジェクト: buchbend/astrolyze
def combine_maps(map1, map2, operation = '/', prefix=False):
    if not prefix:
        prefix = map1.prefix
    outputname = map1.returnName(prefix=prefix,
                                 species='ratio' + map1.species +
                                 '-' +map2.species)
    print outputname
    try:
        pygreg.comm('del /var imagename_1')
    except:
        pass
    pygreg.comm('define char imagename_1*50')

    try:
        pygreg.comm('del /var imagename_2')
    except:
        pass
    pygreg.comm('define char imagename_2*50')

    try:
        pygreg.comm('del /var outputname')
    except:
        pass
    pygreg.comm('define char outputname*50')
    print map1.map_name, map2.map_name
    pygreg.comm('let imagename_1 ' + map1.map_name)
    pygreg.comm('let imagename_2 ' + map2.map_name)
    pygreg.comm('let outputname ' + outputname)
    print map1.map_name
    subprocess.call('cp '+ map1.map_name + ' ' + outputname, shell=True)
    pygreg.comm('image ' + map2.map_name)
    try:
        pygreg.comm('del /var newrg')
    except:
        pass
    print outputname, map2.map_name
    pygreg.comm('define image newrg ' + outputname + ' write')
    pygreg.comm('let newrg newrg' + operation  + 'rg')
コード例 #2
0
ファイル: gildas.py プロジェクト: buchbend/astrolyze
 def save_figure(self, name=None):
     r"""
     Helper function that saves the current plot.
     """
     name = name or self.returnName(dataFormat='eps')
     pygreg.comm('ha ' + name + '/dev eps color')
コード例 #3
0
ファイル: gildas.py プロジェクト: buchbend/astrolyze
    def quick_preview(self, save=False, filename=None, window=True,):
        r"""
        Plotting the map and optionally save the figure.

        Parameters
        ----------
        save : True or False
            Choose wether or nor to save the figure.
        filename : string
            The filename to for the saved plot. If None defaults to
            ``'quick_preview.eps'``.
        window : True or False
            Choose whether the image display is opened or not.
            Default True.
        """
        pygreg.comm('clear')
        pygreg.comm('image ' + self.map_name)
        if window:
            pygreg.comm('dev im w')
        pygreg.comm('lim /rg')
        try:
            pygreg.comm('greg1\\set box match')
        except:
            pass
        pygreg.comm('greg2\\pl')
        try:
            pygreg.comm('greg\\box /abs')
        except:
            pygreg.comm('greg\\box')
        if save:
            filename = filename or 'quick_preview.eps'
            if '.eps' in filename:
                pygreg.comm('ha ' + filename + ' /dev eps color /over')
            if '.png' in filename:
                pygreg.comm('ha ' + filename + ' /dev png color /over')
コード例 #4
0
ファイル: gildas.py プロジェクト: buchbend/astrolyze
 def _init_map_to_greg(self):
     pygreg.comm('image "' + self.map_name + '"')
     self._load_gildas_variables()
     pygreg.comm('let name "' +
                 self.map_name.replace('.' + self.dataFormat, '"'))
     pygreg.comm('let type "' + self.dataFormat + '"')