__author__ = 'matt'
import sys
from cairs_coor import Coor

class Sensor(object):
    """
    function that computes log p(S| [R_1 ,... R_n], I)
    must take a signal S and an array of *not transformed* rain
    """
    def __init__(self, log_p, delta_coor=None, domain_extent=None):
        """@:param log_p - methods for computing
           @:param delta_coor - list of Coor
           @:param domain_extent - cube of integration, relative to sensor position
        """
        self.log_p = log_p
        if not delta_coor and not domain_extent:
            coor=Coor(0.0,0.0,0.0)
            self.delta_coor = [coor]
            self.domain_extent = coor
        else:
            if delta_coor:
                self.delta_coor = delta_coor
                self.domain_extent = Coor(0.0, 0.0, 0.0)
            else:
                self.domain_extent = domain_extent
                self.delta_coor=[]

    def __str__(self):
        if len(self.delta_coor) > 0:
            print "- log likelihood: %s"%self.log_p
            for coor in self.delta_coor:
                print coor

        if not self.domain_extent.IsZero()  :
            print( "- integration domain: %s"%self.domain_extent)
        else:
            print( "- no integration")
