Read from recent PUG format, where axes are in meters
163461
def _read_pug_fixed_grid(projection, distance_multiplier=1.0):
        
        a = projection.semi_major_axis
        h = projection.perspective_point_height
        b = projection.semi_minor_axis

        lon_0 = projection.longitude_of_projection_origin
        sweep_axis = projection.sweep_angle_axis[0]

        proj_dict = {'a': float(a) * distance_multiplier,
                     'b': float(b) * distance_multiplier,
                     'lon_0': float(lon_0),
                     'h': float(h) * distance_multiplier,
                     'proj': 'geos',
                     'units': 'm',
                     'sweep': sweep_axis}
        return proj_dict
1233027
def measure_mags(measures):
    
    import daophot

    image_downloader = ImageDownloader()

    observations = {}
    for measure in measures:
        for reading in measure:
            if reading.obs not in observations:
                observations[reading.obs] = {'x': [],
                                             'y': [],
                                             'source': image_downloader.download(reading, needs_apcor=True)}
            assert isinstance(reading.obs, Observation)
            observations[reading.obs]['x'].append(reading.x)
            observations[reading.obs]['y'].append(reading.y)

    for observation in observations:
        source = observations[observation]['source']
        assert isinstance(source, SourceCutout)
        source.update_pixel_location(observations[observation]['x'],
                                     observations[observation]['y'])
        hdulist_index = source.get_hdulist_idx(observation.ccdnum)
        observations[observation]['mags'] = daophot.phot(source._hdu_on_disk(hdulist_index),
                                                         observations[observation]['x'],
                                                         observations[observation]['y'],
                                                         aperture=source.apcor.aperture,
                                                         sky=source.apcor.sky,
                                                         swidth=source.apcor.swidth,
                                                         apcor=source.apcor.apcor,
                                                         zmag=source.zmag,
                                                         maxcount=30000,
                                                         extno=0)

    return observations
512377
def uvw(self, context):
        

        # Shape (ntime, na, 3)
        (lt, ut), (la, ua), (l, u) = context.array_extents(context.name)

        # Create empty UVW coordinates
        data = np.empty(context.shape, context.dtype)
        data[:,:,0] = np.arange(la+1, ua+1)    # U = antenna index
        data[:,:,1] = 0                        # V = 0
        data[:,:,2] = 0                        # W = 0

        return data
948209
def read_cz_sem(fh, byteorder, dtype, count, offsetsize):
    
    result = {'': ()}
    key = None
    data = bytes2str(stripnull(fh.read(count)))
    for line in data.splitlines():
        if line.isupper():
            key = line.lower()
        elif key:
            try:
                name, value = line.split('=')
            except ValueError:
                try:
                    name, value = line.split(':', 1)
                except Exception:
                    continue
            value = value.strip()
            unit = ''
            try:
                v, u = value.split()
                number = astype(v, (int, float))
                if number != v:
                    value = number
                    unit = u
            except Exception:
                number = astype(value, (int, float))
                if number != value:
                    value = number
                if value in ('No', 'Off'):
                    value = False
                elif value in ('Yes', 'On'):
                    value = True
            result[key] = (name.strip(), value)
            if unit:
                result[key] += (unit,)
            key = None
        else:
            result[''] += (astype(line, (int, float)),)
    return result
1320761
function getMouseCoordinates(e) {
			var coordinates = {
				xAxis: [],
				yAxis: []
			};
			each(axes, function (axis) {
				var translate = axis.translate,
					isXAxis = axis.isXAxis,
					isHorizontal = inverted ? !isXAxis : isXAxis;

				coordinates[isXAxis ? 'xAxis' : 'yAxis'].push({
					axis: axis,
					value: translate(
						isHorizontal ?
							e.chartX - plotLeft  :
							plotHeight - e.chartY + plotTop,
						true
					)
				});
			});
			return coordinates;
		}
622209
def metric_from_cell(cell):
    """"""
    cell = np.asarray(cell, dtype=float)
    return np.dot(cell, cell.T)
653237
def analog_units(self):
        
        au = []
        us = []
        for each in self.points:
            if isinstance(each, NumericPoint):
                au.append(each.properties.name)
                us.append(each.properties.units_state)
        return dict(zip(au, us))
192558
def meter(self, key, **dims):
        """"""
        return super(RegexRegistry, self).meter(self._get_key(key), **dims)
967861
def read(self, line, f, data):
        """"""
        N = len(data["symbols"])
        masses = np.zeros(N, float)
        counter = 0
        while counter < N:
            words = f.readline().split()
            for word in words:
                masses[counter] = float(word)*amu
                counter += 1
        data["masses"] = masses
403996
def GaussSeidelStep(self, S, X, ATYU, rho, lcw, W2):
        """"""

        Xss = np.zeros_like(S, dtype=self.dtype)
        for ax in self.axes:
            Xss += sl.zpad(X[(slice(None),)*ax + (slice(0, -1),)],
                           (1, 0), ax)
            Xss += sl.zpad(X[(slice(None),)*ax + (slice(1, None),)],
                           (0, 1), ax)
        return (rho*(Xss + ATYU) + W2*S) / (W2 + rho*lcw)
96564
def _get_coarse_dataset(self, key, info):
        """"""
        angles = self.root.find('.//Tile_Angles')
        if key in ['solar_zenith_angle', 'solar_azimuth_angle']:
            elts = angles.findall(info['xml_tag'] + '/Values_List/VALUES')
            return np.array([[val for val in elt.text.split()] for elt in elts],
                            dtype=np.float)

        elif key in ['satellite_zenith_angle', 'satellite_azimuth_angle']:
            arrays = []
            elts = angles.findall(info['xml_tag'] + '[@bandId="1"]')
            for elt in elts:
                items = elt.findall(info['xml_item'] + '/Values_List/VALUES')
                arrays.append(np.array([[val for val in item.text.split()] for item in items],
                                       dtype=np.float))
            return np.nanmean(np.dstack(arrays), -1)
        else:
            return
528888
function(dec) {

			if (dec in geolib.sexagesimal) {
				return geolib.sexagesimal[dec];
			}

			var tmp = dec.toString().split('.');

			var deg = Math.abs(tmp[0]);
			var min = ('0.' + tmp[1])*60;
			var sec = min.toString().split('.');

			min = Math.floor(min);
			sec = (('0.' + sec[1]) * 60).toFixed(2);

			geolib.sexagesimal[dec] = (deg + '° ' + min + "' " + sec + '"');

			return geolib.sexagesimal[dec];

		}
36748
def axes(self):
        """"""
        axes = self.element.findall(GML_NS + 'axis')
        return [Axis(axis.find(GML_NS + 'CoordinateSystemAxis')) for
                axis in axes]
1329922
def readAxes(self):
        
        for axisElement in self.root.findall(".axes/axis"):
            axis = {}
            axis['name'] = name = axisElement.attrib.get("name")
            axis['tag'] = axisElement.attrib.get("tag")
            axis['minimum'] = float(axisElement.attrib.get("minimum"))
            axis['maximum'] = float(axisElement.attrib.get("maximum"))
            axis['default'] = float(axisElement.attrib.get("default"))
            # we're not using the map for anything.
            axis['map'] = []
            for warpPoint in axisElement.findall(".map"):
                inputValue = float(warpPoint.attrib.get("input"))
                outputValue = float(warpPoint.attrib.get("output"))
                axis['map'].append((inputValue, outputValue))
            # there are labelnames in the element
            # but we don't need them for building the fonts.
            self.axes[name] = axis
            self.axesOrder.append(axis['name'])
954653
function(item) {
  // Drop newline symbol in error string
  item.msg = (Array.isArray(item.msg) ? item.msg.join(' ') : item.msg).replace('\n', '');
  // Using zero instead of undefined
  item.column = (item.column === undefined) ? 0 : item.column;
  // Drop `PUG:LINT_` prefix in error code
  item.code = chalk.grey(item.code.replace(/(PUG:|LINT_)/g, ''));
  // Formatting output
  var position = chalk.grey(item.line + ':' + item.column);
  return ['', position, chalk.red('error'), item.msg, item.code];
}
358282
def read_mm_uic3(fd, byte_order, dtype, count):
    """"""
    t = numpy.fromfile(fd, byte_order+'I', 2*count)
    return {'wavelengths': t[0::2] // t[1::2]}
1220050
def load(self, dtype_out_time, dtype_out_vert=False, region=False,
             plot_units=False, mask_unphysical=False):
        """"""
        msg = ("Loading data from disk for object={0}, dtype_out_time={1}, "
               "dtype_out_vert={2}, and region="
               "{3}".format(self, dtype_out_time, dtype_out_vert, region))
        logging.info(msg + ' ({})'.format(ctime()))
        # Grab from the object if its there.
        try:
            data = self.data_out[dtype_out_time]
        except (AttributeError, KeyError):
            # Otherwise get from disk.  Try scratch first, then archive.
            try:
                data = self._load_from_disk(dtype_out_time, dtype_out_vert,
                                            region=region)
            except IOError:
                data = self._load_from_tar(dtype_out_time, dtype_out_vert)
        # Copy the array to self.data_out for ease of future access.
        self._update_data_out(data, dtype_out_time)
        # Apply desired plotting/cleanup methods.
        if mask_unphysical:
            data = self.var.mask_unphysical(data)
        if plot_units:
            data = self.var.to_plot_units(data, dtype_vert=dtype_out_vert)
        return data