def plotCiaoLcurve(lcfits_nobkg, lcfits_bkg, nametag, lcbin, obsID, dataPath):

    imgname = str(obsID) + "_" + nametag + "_lcurve_" + str(lcbin) + "s.png"

    # http://cxc.harvard.edu/chips/faq/script.html
    lcstr_nobkg = lcfits_nobkg + '[cols time_bin,count_rate]'
    lcstr_bkg = lcfits_bkg + '[cols time_bin,count_rate]'

    pc.set_preference("window.display", "false")
    hlui.make_figure(lcstr_nobkg, ["symbol.style", "none"])
    hlui.add_curve(lcstr_bkg, ["symbol.style", "none", "line.color", "red"])

    print("      created lightcurve image ")
    print("        --> " + dataPath + imgname)
    pc.print_window(dataPath + imgname, ["clobber", 'True'])

    # http://cxc.harvard.edu/chips/ahelp/chips4.html#Running_ChIPS_in_batch_mode
    #ChIPS always requires the presence of a X server, even when used in a script or
    #program which does not produce on-screen plots (e.g. the "window.display" preference
    #has been set to "false"). When a ChIPS server is started, it tries to connect to the
    #X-display indicated by the DISPLAY environment variable, which can result in one of three cases:
    #  DISPLAY environment variable is valid
    #    In this case the ChIPS server will use the indicated X display for its plots.
    #  DISPLAY environment variable is invalid or unset
    #    it will try to start up a temporary, virtual, framebuffer using the Xvfb program.
    #    If this works then the ChIPS commands will work, including calls to print_window(),
    #    but there will be no on-screen display.
    #  No DISPLAY and no Xvfb
    #    If the Xvfb program does not exist on your system then the server will fail to start
    #    up and report the following:
    #    chips ERROR: Failed to open DISPLAY or Xvfb session- exiting chipsServer

    return
Beispiel #2
0
def begin():
    global _initialized

    chips.lock()    
    chips.advanced.open_undo_buffer()
    if _initialized is False:
        try:
            overrides = config.items('chips')
            for item in overrides:
                chips.set_preference(item[0], item[1])
            chips.add_window() # Have Sherpa talk to its own
                               # chips window
        except NoSectionError:
            chips.unlock()
        except:
            chips.unlock()
            raise
        _initialized = True
Beispiel #3
0
def begin():
    global _initialized

    chips.lock()    
    chips.advanced.open_undo_buffer()
    if _initialized is False:
        try:
            overrides = config.items('chips')
            for item in overrides:
                chips.set_preference(item[0], item[1])
            # OL: No apparent reason to call add_window() here.
            # ChIPS is smart enough to open a window if none are available,
            # plus this code only gets executed if the user has a [chips] section in sherpa.rc
            # which is the exception rather than the rule.
            # chips.add_window() # Have Sherpa talk to its own
                               # chips window
        except NoSectionError:
            chips.unlock()
        except:
            chips.unlock()
            raise
        _initialized = True
Beispiel #4
0
def begin():
    global _initialized

    chips.lock()
    chips.advanced.open_undo_buffer()
    if _initialized is False:
        try:
            overrides = config.items('chips')
            for item in overrides:
                chips.set_preference(item[0], item[1])
            # OL: No apparent reason to call add_window() here.
            # ChIPS is smart enough to open a window if none are available,
            # plus this code only gets executed if the user has a [chips] section in sherpa.rc
            # which is the exception rather than the rule.
            # chips.add_window() # Have Sherpa talk to its own
            # chips window
        except NoSectionError:
            chips.unlock()
        except:
            chips.unlock()
            raise
        _initialized = True