Load the Himawari AHI RSR data for the band requested
197954
def _load(self, filename=None):
        
        if not filename:
            filename = self.filename

        wb_ = open_workbook(filename)
        self.rsr = {}
        sheet_names = []
        for sheet in wb_.sheets():
            if sheet.name in ['Title', ]:
                continue
            ch_name = AHI_BAND_NAMES.get(
                sheet.name.strip(), sheet.name.strip())
            sheet_names.append(sheet.name.strip())
            self.rsr[ch_name] = {'wavelength': None,
                                 'response': None}
            wvl = np.array(
                sheet.col_values(0, start_rowx=5, end_rowx=5453))
            resp = np.array(
                sheet.col_values(2, start_rowx=5, end_rowx=5453))
            self.rsr[ch_name]['wavelength'] = wvl
            self.rsr[ch_name]['response'] = resp
943521
def load_json(filename, gzip_mode=False):
    ''''''

    open_file = open
    if gzip_mode:
        open_file = gzip.open

    try:
        with open_file(filename, 'rt') as fh:
            data = json.load(fh)
            data = convert_unicode_2_utf8(data)
            return data
    except AttributeError:
        # Python-2.6
        fh = open_file(filename, 'rt')
        data = json.load(fh)
        fh.close()
        data = convert_unicode_2_utf8(data)
        return data
156931
public function rsd() {

		$apiArray = array(
			'action' => 'rsd'
		);

		$OSres = $this->get_http()->get( $this->get_base_url(), $apiArray );
		return ( $OSres === false || is_null( $OSres ) ? false : XMLParse::load( $OSres ) );
	}
773183
def load(self, callback=None, errback=None, reload=False):
        
        if not reload and self.data:
            raise MonitorException('monitor already loaded')

        def success(result, *args):
            self.data = result
            if callback:
                return callback(self)
            else:
                return self

        return self._rest.retrieve(self.data['id'], callback=success,
                                   errback=errback)
25817
def load(cls, rr, pk):
        '''
        
        '''
        if pk is None:
            return None
        d = rr.table(cls.table).get(pk).run()
        if d is None:
            return None
        doc = cls(rr, d)
        return doc
1069901
def _load(self, scale=0.001):
        

        with open_workbook(self.path) as wb_:
            for sheet in wb_.sheets():
                if sheet.name not in SHEET_HEADERS.keys():
                    continue

                plt_short_name = PLATFORM_SHORT_NAME.get(self.platform_name)
                if plt_short_name != SHEET_HEADERS.get(sheet.name):
                    continue

                wvl = sheet.col_values(0, 1)
                for idx in range(1, sheet.row_len(0)):
                    ch_name = MSI_BAND_NAMES[plt_short_name].get(str(sheet.col_values(idx, 0, 1)[0]))
                    if ch_name != self.bandname:
                        continue

                    resp = sheet.col_values(idx, 1)
                    resp = np.array(resp)
                    resp = np.where(resp == '', 0, resp).astype('float32')
                    mask = np.less_equal(resp, 0.00001)
                    wvl0 = np.ma.masked_array(wvl, mask=mask)
                    wvl_mask = np.ma.masked_outside(wvl, wvl0.min() - 2, wvl0.max() + 2)

                    wvl = wvl_mask.compressed()
                    resp = np.ma.masked_array(resp, mask=wvl_mask.mask).compressed()
                    self.rsr = {'wavelength': wvl / 1000., 'response': resp}

                    break

                break
452222
def requests_url(self, ptype, **data):
        
        options = {
            'type': ptype,
            'pt': '3.1',
            'channel': self._channel_id,
            'pb': '320',
            'from': 'mainsite',
            'r': '',
            'kbps': '320',
            'app_name': 'radio_website',
            'client': 's:mainsite|y:3.0',
            'version': '100'
        }
        if 'sid' in data:
            options['sid'] = data['sid']
        url = 'https://douban.fm/j/v2/playlist'
        while True:
            try:
                s = requests.get(url, params=options,
                                 cookies=self._cookies, headers=HEADERS)
                req_json = s.json()
                if req_json['r'] == 0:
                    if 'song' not in req_json or not req_json['song']:
                        break
                    return req_json['song'][0]
            except Exception as err:
                raise APIError(err)
                break
        return None
1134815
def load(self):
        
        for i in range(1, self.bands + 1):
            self.__data[i - 1] = self.matrix(i)
1017250
def load(self):
        """"""
        import h5py

        no_detectors_message = False
        with h5py.File(self.filename, 'r') as h5f:
            self.band_names = [b.decode('utf-8') for b in h5f.attrs['band_names'].tolist()]
            self.description = h5f.attrs['description'].decode('utf-8')
            if not self.platform_name:
                try:
                    self.platform_name = h5f.attrs['platform_name'].decode('utf-8')
                except KeyError:
                    LOG.warning("No platform_name in HDF5 file")
                    try:
                        self.platform_name = h5f.attrs[
                            'platform'] + '-' + h5f.attrs['satnum']
                    except KeyError:
                        LOG.warning(
                            "Unable to determine platform name from HDF5 file content")
                        self.platform_name = None

            if not self.instrument:
                try:
                    self.instrument = h5f.attrs['sensor'].decode('utf-8')
                except KeyError:
                    LOG.warning("No sensor name specified in HDF5 file")
                    self.instrument = INSTRUMENTS.get(self.platform_name)

            for bandname in self.band_names:
                self.rsr[bandname] = {}
                try:
                    num_of_det = h5f[bandname].attrs['number_of_detectors']
                except KeyError:
                    if not no_detectors_message:
                        LOG.debug("No detectors found - assume only one...")
                    num_of_det = 1
                    no_detectors_message = True

                for i in range(1, num_of_det + 1):
                    dname = 'det-{0:d}'.format(i)
                    self.rsr[bandname][dname] = {}
                    try:
                        resp = h5f[bandname][dname]['response'][:]
                    except KeyError:
                        resp = h5f[bandname]['response'][:]

                    self.rsr[bandname][dname]['response'] = resp

                    try:
                        wvl = (h5f[bandname][dname]['wavelength'][:] *
                               h5f[bandname][dname][
                                   'wavelength'].attrs['scale'])
                    except KeyError:
                        wvl = (h5f[bandname]['wavelength'][:] *
                               h5f[bandname]['wavelength'].attrs['scale'])

                    # The wavelength is given in micro meters!
                    self.rsr[bandname][dname]['wavelength'] = wvl * 1e6

                    try:
                        central_wvl = h5f[bandname][
                            dname].attrs['central_wavelength']
                    except KeyError:
                        central_wvl = h5f[bandname].attrs['central_wavelength']

                    self.rsr[bandname][dname][
                        'central_wavelength'] = central_wvl
448345
def load_repertoire(name):
    """"""
    root = os.path.abspath(os.path.dirname(__file__))
    filename = os.path.join(root, 'data', 'emd', name)

    return np.load(filename)
1331229
def load(self):
        """"""
        with open(self.filename) as f:
            content = f.readlines()
        content = [" ".join(x.split()).strip('\n').lstrip().split(' ', 1) for x in content]

        # removes duplicated spaces, and splits in two fields, removes leading spaces
        hosts = {}
        host = "NA"
        for line in content:
            if line[0].startswith('#') or line[0] is '':
                pass  # ignore line
            else:
                attribute = line[0]
                value = line[1]
                if attribute.lower().strip() in ['Host', 'host']:
                    host = value
                    hosts[host] = {'host': host}
                else:
                    # In case of special configuration lines, such as port
                    # forwarding,
                    # there would be no 'Host india' line.
                    if host in hosts:
                        hosts[host][attribute] = value
                        # pass
        self.hosts = hosts
1064814
def _load(self, scale=1.0):
        """"""
        data = np.genfromtxt(self.requested_band_filename,
                             unpack=True,
                             names=['wavenumber',
                                    'response'],
                             skip_header=4)

        # Data are wavenumbers in cm-1:
        wavelength = 1. / data['wavenumber'] * 10000.
        response = data['response']

        # The real MetImage has 24 detectors. However, for now we store the
        # single rsr as 'detector-1', indicating that there will be multiple
        # detectors in the future:
        detectors = {}
        detectors['det-1'] = {'wavelength': wavelength, 'response': response}
        self.rsr = detectors
1227535
def user_playlists(self, user_id, page=1, limit=30):
        
        action = 'mtop.alimusic.music.list.collectservice.getcollectbyuser'
        payload = {
            'userId': user_id,
            'pagingVO': {
                'page': page,
                'pageSize': limit
            }
        }
        code, msg, rv = self.request(action, payload)
        # TODO: 支持获取更多
        return rv['data']['data']['collects']
132361
function loadSample(url, doAfterLoading) {
    var fetchSound = new XMLHttpRequest(); // Load the Sound with XMLHttpRequest
    fetchSound.open("GET", url, true); // Path to Audio File
    fetchSound.responseType = "arraybuffer"; // Read as Binary Data
    fetchSound.onload = function() {
        context.decodeAudioData(fetchSound.response, doAfterLoading);
    }
    fetchSound.send();
}
627522
def fetch(self, resource_data=None):
        """"""
        if not self._populated:
            params = {
                "Page"      : self.page,
                "PageSize"  : self.page_size,
            }

            params.update(self._filters)

            if not resource_data:
                self._resource_data = self._client._get(self._url + ".json", params)
            else:
                self._resource_data = resource_data

            self.total = self._resource_data["total"]
            self._page_start = self._resource_data["start"]
            self._page_end = self._resource_data["end"]

            self._populated = True
334163
def download_data
      scraper_data = {}

      @data_to_get.each do |data_category|
        if /liked_(.*)/ =~ data_category
          argument = $1.to_sym  # :tracks, :artists, :stations or :albums
          scraper_data[data_category] = @scraper.public_send(:likes, argument)
        else
          scraper_data[data_category] = @scraper.public_send(data_category)
        end
      end

      scraper_data
    end
979439
def download_rsr(**kwargs):
    

    #
    import tarfile
    import requests
    TQDM_LOADED = True
    try:
        from tqdm import tqdm
    except ImportError:
        TQDM_LOADED = False

    dest_dir = kwargs.get('dest_dir', LOCAL_RSR_DIR)
    dry_run = kwargs.get('dry_run', False)

    LOG.info("Download RSR files and store in directory %s", dest_dir)

    filename = os.path.join(dest_dir, "pyspectral_rsr_data.tgz")
    LOG.debug("Get data. URL: %s", HTTP_PYSPECTRAL_RSR)
    LOG.debug("Destination = %s", dest_dir)
    if dry_run:
        return

    response = requests.get(HTTP_PYSPECTRAL_RSR)
    if TQDM_LOADED:
        with open(filename, "wb") as handle:
            for data in tqdm(response.iter_content()):
                handle.write(data)
    else:
        with open(filename, "wb") as handle:
            for data in response.iter_content():
                handle.write(data)

    tar = tarfile.open(filename)
    tar.extractall(dest_dir)
    tar.close()
    os.remove(filename)