示例#1
0
文件: naming.py 项目: drusk/MOP
    def generate_name(self, astrom_header, fits_header):
        epoch_field = self.get_epoch_field(astrom_header, fits_header)
        count = storage.increment_object_counter(storage.MEASURE3,
                                                 epoch_field,
                                                 dry_run=True)

        base = "DRY"
        return base + count.zfill(7 - len(base))
示例#2
0
文件: naming.py 项目: ijiraq/MOP
    def generate_name(self, astrom_header, fits_header):
        epoch_field = get_epoch_field(astrom_header, fits_header)
        count = storage.increment_object_counter(storage.MEASURE3,
                                                 epoch_field,
                                                 dry_run=True)

        base = "DRY"
        return base + count.zfill(7 - len(base))
示例#3
0
文件: naming.py 项目: drusk/MOP
 def generate_name(self, astrom_header, fits_header):
     """
     Generates a name for an object given the information in its astrom
     observation header and FITS header.
     """
     epoch_field = self.get_epoch_field(astrom_header, fits_header)
     count = storage.increment_object_counter(storage.MEASURE3, epoch_field)
     return epoch_field + count
示例#4
0
文件: naming.py 项目: stephengwyn/MOP
 def generate_name(self, astrom_header, fits_header):
     """
     Generates a name for an object given the information in its astrom
     observation header and FITS header.
     """
     ef = self.get_epoch_field(astrom_header, fits_header)
     epoch_field = ef[0]+ef[1]
     count = storage.increment_object_counter(storage.MEASURE3, epoch_field)
     return ef[1] + count
示例#5
0
    def test_increment_counter_doesnt_exist(self, get_property, set_property):
        get_property.return_value = None

        node_uri = "vos:drusk/OSSOS/astromdir/test"
        epoch_field = "13AE"

        counter = storage.increment_object_counter(node_uri, epoch_field)

        expected_tag = storage.build_counter_tag(epoch_field)
        expected_count = "01"

        get_property.assert_called_once_with(node_uri, expected_tag, ossos_base=True)
        assert_that(counter, equal_to(expected_count))
        set_property.assert_called_once_with(node_uri, expected_tag,
                                             expected_count, ossos_base=True)
示例#6
0
    def test_increment_counter_doesnt_exist(self, get_property, set_property):
        get_property.return_value = None

        node_uri = "vos:drusk/OSSOS/astromdir/test"
        epoch_field = "13AE"

        counter = storage.increment_object_counter(node_uri, epoch_field)

        expected_tag = storage.build_counter_tag(epoch_field)
        expected_count = "01"

        get_property.assert_called_once_with(node_uri, expected_tag, ossos_base=True)
        assert_that(counter, equal_to(expected_count))
        set_property.assert_called_once_with(node_uri, expected_tag,
                                             expected_count, ossos_base=True)
示例#7
0
文件: naming.py 项目: OSSOS/MOP
def _generate_provisional_name(q, astrom_header, fits_header):
    """
    Generates a name for an object given the information in its astrom
    observation header and FITS header.
    :param q: a queue of provisional names to return.
    :type q: Queue
    :param astrom_header:
    :param fits_header:
    """
    while True:
        ef = get_epoch_field(astrom_header, fits_header)
        epoch_field = ef[0] + ef[1]
        count = storage.increment_object_counter(storage.MEASURE3, epoch_field)
        try:
            q.put(ef[1] + count)
        except:
            break
示例#8
0
文件: naming.py 项目: OSSOS/MOP
def _generate_provisional_name(q, astrom_header, fits_header):
    """
    Generates a name for an object given the information in its astrom
    observation header and FITS header.
    :param q: a queue of provisional names to return.
    :type q: Queue
    :param astrom_header:
    :param fits_header:
    """
    while True:
        ef = get_epoch_field(astrom_header, fits_header)
        epoch_field = ef[0] + ef[1]
        count = storage.increment_object_counter(storage.MEASURE3, epoch_field)
        try:
            q.put(ef[1] + count)
        except:
            break
示例#9
0
    def test_increment_object_counter_dryrun(self, get_property, set_property):
        get_property.return_value = "02"

        node_uri = "vos:drusk/OSSOS/astromdir/test"
        epoch_field = "13AE"

        counter = storage.increment_object_counter(node_uri, epoch_field,
                                                   dry_run=True)

        expected_tag = storage.build_counter_tag(epoch_field, dry_run=True)
        expected_count = "03"

        assert_that(counter, equal_to(expected_count))
        get_property.assert_called_once_with(
            node_uri,
            storage.build_counter_tag(epoch_field, dry_run=True),
            ossos_base=True)
        set_property.assert_called_once_with(node_uri,
                                             expected_tag,
                                             expected_count,
                                             ossos_base=True)
示例#10
0
    def test_increment_object_counter_dryrun(self, get_property, set_property):
        get_property.return_value = "02"

        node_uri = "vos:drusk/OSSOS/astromdir/test"
        epoch_field = "13AE"

        counter = storage.increment_object_counter(node_uri, epoch_field,
                                                   dry_run=True)

        expected_tag = storage.build_counter_tag(epoch_field, dry_run=True)
        expected_count = "03"

        assert_that(counter, equal_to(expected_count))
        get_property.assert_called_once_with(
            node_uri,
            storage.build_counter_tag(epoch_field, dry_run=True),
            ossos_base=True)
        set_property.assert_called_once_with(node_uri,
                                             expected_tag,
                                             expected_count,
                                             ossos_base=True)