Exemplo n.º 1
0
    def cat(self, disk, userno):
        _userno = OSystem.PGetAIPSuser()
        OSystem.PSetAIPSuser(userno)

        try:
            num_slots = AIPSDir.PNumber(disk, userno, self.err)
        except OErr.OErr as err:
            OErr.PClear(err)
            return []

        catalog = []
        for cno in range(1, num_slots):
            entry = AIPSDir.PInfo(disk, userno, cno, self.err)
            if entry:
                dict = {}
                dict['cno'] = cno
                dict['name'] = entry[0:12].strip()
                dict['klass'] = entry[13:19].strip()
                dict['seq'] = int(entry[20:25])
                dict['type'] = entry[26:28]
                dict['date'] = entry[29:40]
                dict['time'] = entry[41:49]
                catalog.append(dict)
                pass
            continue
        OSystem.PSetAIPSuser(_userno)
        return catalog
Exemplo n.º 2
0
    def cat(self, disk, userno, url, AIPSdirs):
        # Init Obit if needed
        if not OSystem.PIsInit():
            popsno = 1
            if not self.err:
                self.err=OErr.OErr()
            ObitSys=OSystem.OSystem ("", popsno, userno, \
                                     len(AIPSdirs), AIPSdirs, \
                                     0, [], True, False, self.err)
            OErr.printErrMsg(self.err, "Error with Obit startup")
            doInit = True
        else:
            doInit = False
        _userno = OSystem.PGetAIPSuser()
        OSystem.PSetAIPSuser(userno)

        try:
            num_slots = AIPSDir.PNumber(disk, userno, self.err)
        except OErr.OErr as err:
            OErr.PClear(err)
            if doInit:   # Initialized Obit?
                OSystem.Shutdown(ObitSys)
                self.doInit = False
            return []

        catalog = []
        for slot in range(1, num_slots):
            entry = AIPSDir.PInfo(disk, userno, slot, self.err)
            if entry:
                catalog.append((slot, entry))
                pass
            continue
        # Restore Obit to initial state
        OSystem.PSetAIPSuser(_userno)
        if doInit:   # Initialized Obit?
            OSystem.Shutdown(ObitSys)
            self.doInit = False
        OErr.printErrMsg(self.err, "Error with AIPS Catalog")
        return catalog
Exemplo n.º 3
0
    def cat(self, disk, userno, url, AIPSdirs):
        # Init Obit if needed
        if not OSystem.PIsInit():
            popsno = 1
            if not self.err:
                self.err=OErr.OErr()
            ObitSys=OSystem.OSystem ("", popsno, userno, \
                                     len(AIPSdirs), AIPSdirs, \
                                     0, [], True, False, self.err)
            OErr.printErrMsg(self.err, "Error with Obit startup")
            doInit = True
        else:
            doInit = False
        _userno = OSystem.PGetAIPSuser()
        OSystem.PSetAIPSuser(userno)

        try:
            num_slots = AIPSDir.PNumber(disk, userno, self.err)
        except OErr.OErr, err:
            OErr.PClear(err)
            if doInit:   # Initialized Obit?
                OSystem.Shutdown(ObitSys)
                self.doInit = False
            return []