How to use the ehtim.array.Array function in ehtim

To help you get started, we’ve selected a few ehtim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sao-eht / eat / eat / apcal / vex.py View on Github external
if len(ret)>0:
                    site_position = re.findall("[-+]?\d+[\.]?\d*",line)

                # same format as Andrew's array tables
                if line[0:6]=="enddef":
                    sites.append([site_name,site_position[0],site_position[1],site_position[2],SEFD])
                    indef=False


        # Construct Array() object of Andrew's format
        # mimic the function "load_array(filename)"
        # TODO this does not store d-term and pol cal. information!
        tdataout = [np.array((x[0],float(x[1]),float(x[2]),float(x[3]),float(x[4]),float(x[4]),0.0, 0.0, 0.0, 0.0, 0.0),
                               dtype=DTARR) for x in sites]
        tdataout = np.array(tdataout)
        self.array = ehtim.array.Array(tdataout)


        # SCHED  =========================================================
        SCHED = self.get_sector('SCHED')
        sched = []
        inscan = False

        for i in range(len(SCHED)):

            line = SCHED[i]
            if line[0:4]=="scan":
                inscan=True
                temp={}
                temp['scan']={}
                cnt = 0
github achael / eht-imaging / ehtim / obsdata.py View on Github external
def recompute_uv(self):

        """Recompute u,v points using observation times and metadata

           Args:

           Returns:
                (Obsdata): New Obsdata object containing the same data with recomputed u,v points
        """

        times = self.data['time']
        site1 = self.data['t1']
        site2 = self.data['t2']
        arr = ehtim.array.Array(self.tarr)
        print ("Recomputing U,V Points using MJD %d \n RA %e \n DEC %e \n RF %e GHz"
                                       % (self.mjd, self.ra, self.dec, self.rf/1.e9))

        (timesout,uout,vout) = compute_uv_coordinates(arr, site1, site2, times, self.mjd, self.ra, self.dec,
                                                      self.rf, timetype=self.timetype, elevmin=0, elevmax=90)

        if len(timesout) != len(times):
            raise Exception("len(timesout) != len(times) in recompute_uv: check elevation  limits!!")

        datatable = self.data.copy()
        datatable['u'] = uout
        datatable['v'] = vout
        return Obsdata(self.ra, self.dec, self.rf, self.bw, np.array(datatable), self.tarr, source=self.source, mjd=self.mjd,
                         ampcal=self.ampcal, phasecal=self.phasecal, opacitycal=self.opacitycal, dcal=self.dcal, frcal=self.frcal,
                         timetype=self.timetype, scantable=self.scans)
github sao-eht / eat / eat / aips / vex.py View on Github external
if len(ret)>0:
                    site_position = re.findall("[-+]?\d+[\.]?\d*",line)

                # same format as Andrew's array tables
                if line[0:6]=="enddef":
                    sites.append([site_name,site_position[0],site_position[1],site_position[2],SEFD])
                    indef=False


        # Construct Array() object of Andrew's format
        # mimic the function "load_array(filename)"
        # TODO this does not store d-term and pol cal. information!
        tdataout = [np.array((x[0],float(x[1]),float(x[2]),float(x[3]),float(x[4]),float(x[4]),0.0, 0.0, 0.0, 0.0, 0.0),
                               dtype=DTARR) for x in sites]
        tdataout = np.array(tdataout)
        self.array = ehtim.array.Array(tdataout)


        # SCHED  =========================================================
        SCHED = self.get_sector('SCHED')
        sched = []
        inscan = False

        for i in range(len(SCHED)):

            line = SCHED[i]
            if line[0:4]=="scan":
                inscan=True
                temp={}
                temp['scan']={}
                cnt = 0
github achael / eht-imaging / ehtim / io / load.py View on Github external
float(x[6]), float(x[7]), float(x[8])),
                             dtype=DTARR) for x in tdata]

    tdataout = np.array(tdataout)
    edata = {}
    for line in tdataout:
        if np.all(np.array([line['x'],line['y'],line['z']]) == (0.,0.,0.)):
            sitename = str(line['site'])
            ephempath = path  + '/' + ephemdir + '/' + sitename #TODO ephempath shouldn't always start with path
            try:
                edata[sitename] = np.loadtxt(ephempath, dtype=bytes, comments='#', delimiter='/').astype(str)
                print('loaded spacecraft ephemeris %s' % ephempath)
            except IOError:
                raise Exception ('no ephemeris file %s !' % ephempath)

    return ehtim.array.Array(tdataout, ephem=edata)
github achael / eht-imaging / ehtim / vex.py View on Github external
if len(ret)>0:
                    site_position = re.findall("[-+]?\d+[\.]?\d*",line)

                # same format as Andrew's array tables
                if line[0:6]=="enddef":
                    sites.append([site_name,site_position[0],site_position[1],site_position[2],SEFD])
                    indef=False


        # Construct Array() object of Andrew's format
        # mimic the function "load_array(filename)"
        # TODO this does not store d-term and pol cal. information!
        tdataout = [np.array((x[0],float(x[1]),float(x[2]),float(x[3]),float(x[4]),float(x[4]),0.0, 0.0, 0.0, 0.0, 0.0),
                               dtype=DTARR) for x in sites]
        tdataout = np.array(tdataout)
        self.array = ehtim.array.Array(tdataout)

        # SCHED  =========================================================
        SCHED = self.get_sector('SCHED')
        sched = []
        inscan = False

        for i in range(len(SCHED)):

            line = SCHED[i]
            if line[0:4]=="scan":
                inscan=True
                temp={}
                temp['scan']={}
                cnt = 0

            if inscan:
github achael / eht-imaging / ehtim / vex.py View on Github external
if len(ret)>0:
                    site_position = re.findall("[-+]?\d+[\.]?\d*",line)

                # same format as Andrew's array tables
                if line[0:6]=="enddef":
                    sites.append([site_name,site_position[0],site_position[1],site_position[2],SEFD])
                    indef=False


        # Construct Array() object of Andrew's format
        # mimic the function "load_array(filename)"
        # TODO this does not store d-term and pol cal. information!
        tdataout = [np.array((x[0],float(x[1]),float(x[2]),float(x[3]),float(x[4]),float(x[4]),0.0, 0.0, 0.0, 0.0, 0.0),
                               dtype=DTARR) for x in sites]
        tdataout = np.array(tdataout)
        self.array = ehtim.array.Array(tdataout)

        # SCHED  =========================================================
        SCHED = self.get_sector('SCHED')
        sched = []
        inscan = False

        for i in range(len(SCHED)):

            line = SCHED[i]
            if line[0:4]=="scan":
                inscan=True
                temp={}
                temp['scan']={}
                cnt = 0

            if inscan:
github achael / eht-imaging / ehtim / array.py View on Github external
def make_subarray(self, sites):
        """Make a subarray from the Array object array that only includes the sites listed in sites.

           Args:
               sites (list) : list of sites in the subarray
           Returns:
               Array: an Array object with specified sites and metadata
        """
        all_sites = [t[0] for t in self.tarr]
        mask = np.array([t in sites for t in all_sites])
        return Array(self.tarr[mask],ephem=self.ephem)