Example #1
0
    def __init__(self, path_rendered, dpkgRoot, dpkg,  **kwargs):
        Ccoder.__init__(self, dpkgRoot, dpkg, **kwargs)
        Data.__init__(self, path_rendered, dpkgRoot, dpkg,  **kwargs)

        self.path_rendered = os.path.abspath(unicode(path_rendered, 'utf8'))
        self.env = Environment(loader=FileSystemLoader(os.path.join(self.path_rendered, 'C', 'templates')))
        self.env.filters.update({
            'is_prior': lambda x: ('require' in x) and ('fields' not in x['require']) and ('data' in x) and ('distribution' in x['data'])
        })
Example #2
0
    def __init__(self, path_rendered, dpkgRoot, dpkg,  **kwargs):
        Ccoder.__init__(self, dpkgRoot, dpkg, **kwargs)
        Data.__init__(self, path_rendered, dpkgRoot, dpkg,  **kwargs)

        self.path_rendered = os.path.abspath(unicode(path_rendered, 'utf8'))
        self.env = Environment(loader=FileSystemLoader(os.path.join(self.path_rendered, 'C', 'templates')))
        self.env.filters.update({
            'is_prior': lambda x: ('data' in x) and isinstance(x['data'], dict) and ('data' in x['data']) and ('distribution' in x['data']['data'])
        })
Example #3
0
    def __init__(self,
                 file,
                 definition_message,
                 field_definition,
                 english_units=False):
        self.field_definition = field_definition
        self.english_units = english_units

        fdn = field_definition.fdn_value()
        self.field = definition_message.field(fdn)

        endian = definition_message.architecture()
        type = field_definition.type_string()
        count = field_definition.type_count()
        schema = collections.OrderedDict([(self.field.name,
                                           [type, count, '%d'])])

        Data.__init__(self, file, schema, None, endian)
Example #4
0
    def __init__(self, record_header, file):
        Data.__init__(self, file, DefinitionMessage.primary_schema,
                      DefinitionMessage.secondary_schema)
        self.record_header = record_header

        if self.message_number() in DefinitionMessage.known_messages.keys():
            self.message_data = DefinitionMessage.known_messages[
                self.message_number()]
        else:
            logger.info("Unknown message number %d: %s" %
                        (self.message_number(), str(self.decoded_data)))
            self.message_data = DefinitionMessage.unknown_message

        self.field_definitions = []
        for index in xrange(self.field_count()):
            field_definition = FieldDefinition(file)
            self.file_size += field_definition.file_size
            self.field_definitions.append(field_definition)
Example #5
0
 def __init__(self,base=None):
     """ Initializes the new Diffed_Data() class through a deepcopy
 
         Assumptions:
         N/A
 
         Source:
         N/A
 
         Inputs:
         N/A
 
         Outputs:
         N/A
 
         Properties Used:
         N/A    
     """  
     if base is None: base = Data()
     self._base = base
     this = deepcopy(base) # deepcopy is needed here to build configs - Feb 2016, T. MacDonald
     Data.__init__(self,this)
Example #6
0
 def __init__(self,base=None):
     if base is None: base = Data()
     self._base = base
     this = deepcopy(base) # deepcopy is needed here to build configs - Feb 2016, T. MacDonald
     Data.__init__(self,this)
 def __init__(self):
     Data.__init__(self)
     self.file_content = None
     self.raw_rules = None
     self.processed_rules = list()
     self.postfix_expressions = list()
Example #8
0
 def __init__(self, file):
     Data.__init__(self, file, FieldDefinition.schema)
Example #9
0
File: RVC.py Project: zkbt/transit
	def __init__(self, bjd=None, rv=None, uncertainty=None,
						inputfilename=None, directory=None,
						name=None,
						remake=False,
						color='slategray',
						isfake=False,
						telescope=None,
						**kwargs):

		# initialize the Talker object
		Data.__init__(self)
		self.speak('creating a RV curve')

		# initialize the base color
		self.color = color


		# define a dictionary of flags that can be used for bad data
		self.flags = dict(outlier=1, saturation=2, custom=4)


		# keep track of the telescope (and epoch)
		self.telescope=telescope
		self.epoch=None

		# is this a real light curve, or a fake one?
		#  (e.g., one at high resolution for plotting)
		self.isfake = isfake

		# specify the original filename
		self.inputfilename = inputfilename

		# specify a directory in which to store saved versions of this TLC,
		# 	as well as other outputs (plots, etc...)
		self.directory = directory
		if self.directory is None:
			try:
				self.directory = '/'.join(self.inputfilename.replace('data/', 'fits/').split('/')[:-1]) + '/'
				zachopy.utils.mkdir(self.directory)
			except AttributeError:
				pass
		self.speak('assigning it the directory {0}'.format(self.directory))

		# initialize the TLC by filling it with data
		self.initialize(bjd=bjd, rv=rv, uncertainty=uncertainty, remake=remake, **kwargs)

		# make sure an array of "bad" values is defined
		try:
			self.bad
		except AttributeError:
			try:
				self.bad = kwargs['bad']
			except KeyError:
				self.bad = np.isfinite(self.rv) == False

		# assign a name to this lightcurve
		if name is None:
			if self.telescope is None:
				name = '???'
			else:
				name = self.telescope
		self.name = name

		# assign the colors for this light curve
		self.setupColors(color=color, minimumuncertainty=None)
Example #10
0
 def __init__(self, file):
     Data.__init__(self, file, FileHeader.primary_schema, FileHeader.optional_schema)
Example #11
0
 def __init__(self, file):
     Data.__init__(self, file, RecordHeader.schema)