<commit_before>
from tkp.utility.coordinates import WCS
import datetime


	
def extract_metadata(dataaccessor):
    return {
        'tau_time': dataaccessor.tau_time,
        'freq_eff': dataaccessor.freq_eff,
        'freq_bw': dataaccessor.freq_bw,
        'taustart_ts': dataaccessor.taustart_ts.strftime("%Y-%m-%d %H:%M:%S.%f"),
        'url': dataaccessor.url,
        'band': 0,    # not yet clearly defined
        'bsmaj': float(dataaccessor.beam[0]), ## NB We must cast to a standard python float
        'bsmin': float(dataaccessor.beam[1]), ## as Monetdb converter cannot handle numpy.float64
        'bpa': float(dataaccessor.beam[2]),
        'centre_ra': dataaccessor.centre_ra,
        'centre_decl': dataaccessor.centre_decl,
        'subbandwidth': dataaccessor.subbandwidth,
        'antenna_set': dataaccessor.antenna_set,
        'subbands': dataaccessor.subbands,
        'channels': dataaccessor.channels,
        'ncore': dataaccessor.ncore,
        'nremote': dataaccessor.nremote,
        'nintl': dataaccessor.nintl,
    }



class DataAccessor(object):
    """
    Base class for accessors used with :class:`..sourcefinder.image.ImageData`.

    Data accessors provide a uniform way for the ImageData class (ie, generic
    image representation) to access the various ways in which images may be
    stored (FITS files, arrays in memory, potentially HDF5, etc).
    """

    def __init__(self):
        self.beam = (None, None, None)
        self.wcs = WCS()
        self.tau_time = 0.  # integration seconds
        self.taustart_ts = datetime.datetime(1970, 1, 1, 0, 0, 0)
        self.freq_bw = None
        self.freq_eff = None  # Hertz (? MHz?)
        self.subbandwidth = None
        self.url = "not set"
        self.data = None
        self.centre_ra = 0
        self.centre_decl = 0
        self.antenna_set = None
        self.subbands = 0
        self.channels = 0
        self.ncore = 0
        self.nremote = 0
        self.nintl = 0
<commit_msg>Note units in dataaccessor.py<commit_after>from tkp.utility.coordinates import WCS
import datetime

def extract_metadata(dataaccessor):
    return {
        'tau_time': dataaccessor.tau_time,
        'freq_eff': dataaccessor.freq_eff,
        'freq_bw': dataaccessor.freq_bw,
        'taustart_ts': dataaccessor.taustart_ts.strftime("%Y-%m-%d %H:%M:%S.%f"),
        'url': dataaccessor.url,
        'band': 0,    # not yet clearly defined
        'bsmaj': float(dataaccessor.beam[0]), ## NB We must cast to a standard python float
        'bsmin': float(dataaccessor.beam[1]), ## as Monetdb converter cannot handle numpy.float64
        'bpa': float(dataaccessor.beam[2]),
        'centre_ra': dataaccessor.centre_ra,
        'centre_decl': dataaccessor.centre_decl,
        'subbandwidth': dataaccessor.subbandwidth,
        'antenna_set': dataaccessor.antenna_set,
        'subbands': dataaccessor.subbands,
        'channels': dataaccessor.channels,
        'ncore': dataaccessor.ncore,
        'nremote': dataaccessor.nremote,
        'nintl': dataaccessor.nintl,
    }

class DataAccessor(object):
    """
    Base class for accessors used with :class:`..sourcefinder.image.ImageData`.

    Data accessors provide a uniform way for the ImageData class (ie, generic
    image representation) to access the various ways in which images may be
    stored (FITS files, arrays in memory, potentially HDF5, etc).
    """

    def __init__(self):
        self.beam = (None, None, None) # bmaj (px), bmin (px), bpa (rad)
        self.wcs = WCS()
        self.tau_time = 0.  # integration seconds
        self.taustart_ts = datetime.datetime(1970, 1, 1, 0, 0, 0)
        self.freq_bw = None
        self.freq_eff = None  # Hertz (? MHz?)
        self.subbandwidth = None
        self.url = "not set"
        self.data = None
        self.centre_ra = 0
        self.centre_decl = 0
        self.antenna_set = None
        self.subbands = 0
        self.channels = 0
        self.ncore = 0
        self.nremote = 0
        self.nintl = 0
{'fraction_non_alphanumeric': 0.11246578750933067, 'fraction_numerical': 0.011943269470017417, 'mean_word_length': 2.5606731620903456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3089683', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1285, 'n_words': 322}