Example #1
0
File: naming.py Project: 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))
Example #2
0
File: naming.py Project: 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))
Example #3
0
File: naming.py Project: 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
Example #4
0
 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
Example #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)
Example #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)
Example #7
0
File: naming.py Project: 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
Example #8
0
File: naming.py Project: 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
Example #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)
Example #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)