_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q245700
ATLAS2.store_disorder
train
def store_disorder(self, sc=None, force_rerun=False): """Wrapper for _store_disorder""" log.info('Loading sequences to reference GEM-PRO...') from random import shuffle g_ids = [g.id for g in self.reference_gempro.functional_genes] shuffle(g_ids) def _store_disorder_sc(g...
python
{ "resource": "" }
q245701
ATLAS2._align_orthologous_gene_pairwise
train
def _align_orthologous_gene_pairwise(self, g_id, gapopen=10, gapextend=0.5, engine='needle', parse=True, force_rerun=False): """Align orthologous strain sequences to representative Protein sequence, save as new pickle""" protein_seqs_aln_pickle_path = op.join(self.sequences_by_gene_dir, '{}_protein_with...
python
{ "resource": "" }
q245702
ATLAS2.align_orthologous_genes_pairwise
train
def align_orthologous_genes_pairwise(self, sc=None, joblib=False, cores=1, gapopen=10, gapextend=0.5, engine='needle', parse=True, force_rerun=False): """Wrapper for _align_orthologous_gene_pairwise""" log.info('Aligning sequences to reference GEM-PRO...') ...
python
{ "resource": "" }
q245703
cast_to_str
train
def cast_to_str(obj): """Return a string representation of a Seq or SeqRecord. Args: obj (str, Seq, SeqRecord): Biopython Seq or SeqRecord Returns: str: String representation of the sequence """ if isinstance(obj, str): return obj if isinstance(obj, Seq):
python
{ "resource": "" }
q245704
cast_to_seq
train
def cast_to_seq(obj, alphabet=IUPAC.extended_protein): """Return a Seq representation of a string or SeqRecord object. Args: obj (str, Seq, SeqRecord): Sequence string or Biopython SeqRecord object alphabet: See Biopython SeqRecord docs Returns: Seq: Seq representation of the seque...
python
{ "resource": "" }
q245705
cast_to_seq_record
train
def cast_to_seq_record(obj, alphabet=IUPAC.extended_protein, id="<unknown id>", name="<unknown name>", description="<unknown description>", dbxrefs=None, features=None, annotations=None, letter_annotations=None): """Return a SeqRecord representati...
python
{ "resource": "" }
q245706
write_fasta_file
train
def write_fasta_file(seq_records, outname, outdir=None, outext='.faa', force_rerun=False): """Write a FASTA file for a SeqRecord or a list of SeqRecord objects. Args: seq_records (SeqRecord, list): SeqRecord or a list of SeqRecord objects outname: Name of the output file which will have outext ...
python
{ "resource": "" }
q245707
write_fasta_file_from_dict
train
def write_fasta_file_from_dict(indict, outname, outdir=None, outext='.faa', force_rerun=False): """Write a FASTA file for a dictionary of IDs and their sequence strings. Args: indict: Input dictionary with keys as IDs and values as sequence strings outname: Name of the output file which will ha...
python
{ "resource": "" }
q245708
write_seq_as_temp_fasta
train
def write_seq_as_temp_fasta(seq): """Write a sequence as a temporary FASTA file Args: seq (str, Seq, SeqRecord): Sequence string, Biopython Seq or SeqRecord object Returns:
python
{ "resource": "" }
q245709
load_fasta_file
train
def load_fasta_file(filename): """Load a FASTA file and return the sequences as a list of SeqRecords Args: filename (str): Path to the FASTA file to
python
{ "resource": "" }
q245710
fasta_files_equal
train
def fasta_files_equal(seq_file1, seq_file2): """Check equality of a FASTA file to another FASTA file Args: seq_file1: Path to a FASTA file seq_file2: Path to another FASTA file Returns: bool: If the sequences are the same """ # Load already set representative sequence ...
python
{ "resource": "" }
q245711
Protein.from_structure
train
def from_structure(cls, original, filter_residues): """ Loads structure as a protein, exposing protein-specific methods. """ P = cls(original.id) P.full_id = original.full_id for child in original.child_dict.values(): copycat = deepcopy(child)...
python
{ "resource": "" }
q245712
AMYLPRED.get_aggregation_propensity
train
def get_aggregation_propensity(self, seq, outdir, cutoff_v=5, cutoff_n=5, run_amylmuts=False): """Run the AMYLPRED2 web server for a protein sequence and get the consensus result for aggregation propensity. Args: seq (str, Seq, SeqRecord): Amino acid sequence outdir (str): Direc...
python
{ "resource": "" }
q245713
AMYLPRED.run_amylpred2
train
def run_amylpred2(self, seq, outdir, run_amylmuts=False): """Run all methods on the AMYLPRED2 web server for an amino acid sequence and gather results. Result files are cached in ``/path/to/outdir/AMYLPRED2_results``. Args: seq (str): Amino acid sequence as a string out...
python
{ "resource": "" }
q245714
AMYLPRED.parse_method_results
train
def parse_method_results(self, results_file, met): """Parse the output of a AMYLPRED2 result file.""" result = str(open(results_file).read()) ind_s = str.find(result, 'HITS') ind_e = str.find(result, '**NOTE') tmp = result[ind_s + 10:ind_e].strip(" ") hits_resid = [] ...
python
{ "resource": "" }
q245715
_load_video
train
def _load_video(video_filename): """Load a video into a numpy array""" video_filename = str(video_filename) print("Loading " + video_filename) if not os.path.isfile(video_filename): raise Exception("File Not Found: %s" % video_filename) # noinspection PyArgumentList capture = cv2.VideoCa...
python
{ "resource": "" }
q245716
get_capture_dimensions
train
def get_capture_dimensions(capture): """Get the dimensions of a capture""" width
python
{ "resource": "" }
q245717
save_video
train
def save_video(video, fps, save_filename='media/output.avi'): """Save a video to disk""" # fourcc = cv2.CAP_PROP_FOURCC('M', 'J', 'P', 'G') print(save_filename) video = float_to_uint8(video) fourcc = cv2.VideoWriter_fourcc(*'MJPG') writer = cv2.VideoWriter(save_filename, fourcc, fps,
python
{ "resource": "" }
q245718
show_frequencies
train
def show_frequencies(vid_data, fps, bounds=None): """Graph the average value of the video as well as the frequency strength""" averages = [] if bounds: for x in range(1, vid_data.shape[0] - 1): averages.append(vid_data[x, bounds[2]:bounds[3], bounds[0]:bounds[1], :].sum()) else: ...
python
{ "resource": "" }
q245719
gaussian_video
train
def gaussian_video(video, shrink_multiple): """Create a gaussian representation of a video""" vid_data = None for x in range(0, video.shape[0]): frame = video[x] gauss_copy = np.ndarray(shape=frame.shape, dtype="float") gauss_copy[:] = frame for i in range(shrink_multiple): ...
python
{ "resource": "" }
q245720
combine_pyramid_and_save
train
def combine_pyramid_and_save(g_video, orig_video, enlarge_multiple, fps, save_filename='media/output.avi'): """Combine a gaussian video representation with the original and save to file""" width, height = get_frame_dimensions(orig_video[0]) fourcc = cv2.VideoWriter_fourcc(*'MJPG') print("Outputting to %...
python
{ "resource": "" }
q245721
Messages.price
train
def price(self, from_=None, **kwargs): """ Check pricing for a new outbound message. An useful synonym for "message" command with "dummy" parameters set to true. :Example: message = client.messages.price(from_="447624800500", phones="999000001", text="Hello!", lists="1909100") ...
python
{ "resource": "" }
q245722
Tokens.refresh
train
def refresh(self): """ Refresh access token. Only non-expired tokens can be renewed. :Example:
python
{ "resource": "" }
q245723
Users.update
train
def update(self, **kwargs): """ Update an current User via a PUT request. Returns True if success. :Example: client.user.update(firstName="John", lastName="Doe", company="TextMagic") :param str firstName: User first name. Required. :param str lastName: User la...
python
{ "resource": "" }
q245724
Subaccounts.send_invite
train
def send_invite(self, **kwargs): """ Invite new subaccount. Returns True if success. :Example: s = client.subaccounts.create(email="johndoe@yahoo.com", role="A")
python
{ "resource": "" }
q245725
Chats.by_phone
train
def by_phone(self, phone, **kwargs): """ Fetch messages from chat with specified phone number. :Example: chat = client.chats.by_phone(phone="447624800500") :param str phone: Phone number in E.164 format. :param int page: Fetch specified results page. Default=1 ...
python
{ "resource": "" }
q245726
get_credentials
train
def get_credentials(env=None): """ Gets the TextMagic credentials from current environment :param env: environment :return: username, token """ environ = env or os.environ try: username = environ["TEXTMAGIC_USERNAME"]
python
{ "resource": "" }
q245727
Lists.put_contacts
train
def put_contacts(self, uid, **kwargs): """ Assign contacts to the specified list. :Example: client.lists.put_contacts(uid=1901010, contacts="1723812,1239912") :param int uid: The unique id of the List. Required. :param str contacts: Contact ID(s), separated by com...
python
{ "resource": "" }
q245728
Lists.delete_contacts
train
def delete_contacts(self, uid, **kwargs): """ Unassign contacts from the specified list. If contacts assign only to the specified list, then delete permanently. Returns True if success. :Example: client.lists.delete_contacts(uid=1901010, contacts="1723812,1239912") ...
python
{ "resource": "" }
q245729
get_cert_file
train
def get_cert_file(): """ Get the certificates file for https""" try: current_path = os.path.realpath(__file__) ca_cert_path = os.path.join(current_path, "..", "..", "..",
python
{ "resource": "" }
q245730
make_tm_request
train
def make_tm_request(method, uri, **kwargs): """ Make a request to TextMagic REST APIv2. :param str method: "POST", "GET", "PUT" or "DELETE" :param str uri: URI to process request. :return: :class:`Response` """ headers = kwargs.get("headers", {}) user_agent = "textmagic-python/%s (P...
python
{ "resource": "" }
q245731
CollectionModel.update_instance
train
def update_instance(self, uid, body): """ Update an Model via a PUT request :param str uid: String identifier for the list resource :param dict body: Dictionary of items to PUT """ uri =
python
{ "resource": "" }
q245732
CollectionModel.delete_instance
train
def delete_instance(self, uid): """ Delete an ObjectModel via a DELETE request :param int uid: Unique id
python
{ "resource": "" }
q245733
_BoundStructArray._get_buffer
train
def _get_buffer(self, index): """Shared bounds checking and buffer creation.""" if not 0 <= index < self.count: raise IndexError() size = struct.calcsize(self.format) # We create the buffer every time instead of
python
{ "resource": "" }
q245734
NumerAPI._unzip_file
train
def _unzip_file(self, src_path, dest_path, filename): """unzips file located at src_path into destination_path""" self.logger.info("unzipping file...") # construct full path (including file name) for unzipping unzip_path = os.path.join(dest_path,
python
{ "resource": "" }
q245735
NumerAPI.get_dataset_url
train
def get_dataset_url(self, tournament=1): """Fetch url of the current dataset. Args: tournament (int, optional): ID of the tournament, defaults to 1 Returns: str: url of the current dataset Example: >>> NumerAPI().get_dataset_url() https:...
python
{ "resource": "" }
q245736
NumerAPI.raw_query
train
def raw_query(self, query, variables=None, authorization=False): """Send a raw request to the Numerai's GraphQL API. This function allows to build your own queries and fetch results from Numerai's GraphQL API. Checkout https://medium.com/numerai/getting-started-with-numerais-new-tournam...
python
{ "resource": "" }
q245737
NumerAPI.get_staking_leaderboard
train
def get_staking_leaderboard(self, round_num=0, tournament=1): """Retrieves the leaderboard of the staking competition for the given round. Args: round_num (int, optional): The round you are interested in, defaults to current round. tournament (int, option...
python
{ "resource": "" }
q245738
NumerAPI.get_nmr_prize_pool
train
def get_nmr_prize_pool(self, round_num=0, tournament=1): """Get NMR prize pool for the given round and tournament. Args: round_num (int, optional): The round you are interested in, defaults to current round. tournament (int, optional): ID of the tournament, defau...
python
{ "resource": "" }
q245739
NumerAPI.get_competitions
train
def get_competitions(self, tournament=1): """Retrieves information about all competitions Args: tournament (int, optional): ID of the tournament, defaults to 1 Returns: list of dicts: list of rounds Each round's dict contains the following items: ...
python
{ "resource": "" }
q245740
NumerAPI.get_current_round
train
def get_current_round(self, tournament=1): """Get number of the current active round. Args: tournament (int): ID of the tournament (optional, defaults to 1) Returns: int: number of the current active round Example: >>> NumerAPI().get_current_round()...
python
{ "resource": "" }
q245741
NumerAPI.get_tournaments
train
def get_tournaments(self, only_active=True): """Get all tournaments Args: only_active (bool): Flag to indicate of only active tournaments should be returned or all of them. Defaults to True. Returns: list o...
python
{ "resource": "" }
q245742
NumerAPI.get_submission_filenames
train
def get_submission_filenames(self, tournament=None, round_num=None): """Get filenames of the submission of the user. Args: tournament (int): optionally filter by ID of the tournament round_num (int): optionally filter round number Returns: list: list of user...
python
{ "resource": "" }
q245743
NumerAPI.get_rankings
train
def get_rankings(self, limit=50, offset=0): """Get the overall ranking Args: limit (int): number of items to return (optional, defaults to 50) offset (int): number of items to skip (optional, defaults to 0) Returns: list of dicts: list of ranking items ...
python
{ "resource": "" }
q245744
NumerAPI.get_submission_ids
train
def get_submission_ids(self, tournament=1): """Get dict with username->submission_id mapping. Args: tournament (int): ID of the tournament (optional, defaults to 1) Returns: dict: username->submission_id mapping, string->string Example: >>> NumerAPI...
python
{ "resource": "" }
q245745
NumerAPI.get_user
train
def get_user(self): """Get all information about you! Returns: dict: user information including the following fields: * assignedEthAddress (`str`) * availableNmr (`decimal.Decimal`) * availableUsd (`decimal.Decimal`) * banned ...
python
{ "resource": "" }
q245746
NumerAPI.get_payments
train
def get_payments(self): """Get all your payments. Returns: list of dicts: payments For each payout in the list, a dict contains the following items: * nmrAmount (`decimal.Decimal`) * usdAmount (`decimal.Decimal`) * tournament (`s...
python
{ "resource": "" }
q245747
NumerAPI.get_transactions
train
def get_transactions(self): """Get all your deposits and withdrawals. Returns: dict: lists of your NMR and USD transactions The returned dict has the following structure: * nmrDeposits (`list`) contains items with fields: * from (`str`) ...
python
{ "resource": "" }
q245748
NumerAPI.get_stakes
train
def get_stakes(self): """List all your stakes. Returns: list of dicts: stakes Each stake is a dict with the following fields: * confidence (`decimal.Decimal`) * roundNumber (`int`) * tournamentId (`int`) * soc (`d...
python
{ "resource": "" }
q245749
NumerAPI.submission_status
train
def submission_status(self, submission_id=None): """submission status of the last submission associated with the account. Args: submission_id (str): submission of interest, defaults to the last submission done with the account Returns: dict: submission s...
python
{ "resource": "" }
q245750
NumerAPI.upload_predictions
train
def upload_predictions(self, file_path, tournament=1): """Upload predictions from file. Args: file_path (str): CSV file with predictions that will get uploaded tournament (int): ID of the tournament (optional, defaults to 1) Returns: str: submission_id ...
python
{ "resource": "" }
q245751
NumerAPI.check_submission_successful
train
def check_submission_successful(self, submission_id=None): """Check if the last submission passes submission criteria. Args: submission_id (str, optional): submission of interest, defaults to the last submission done with the account Return: bool: True i...
python
{ "resource": "" }
q245752
NumerAPI.tournament_number2name
train
def tournament_number2name(self, number): """Translate tournament number to tournament name. Args: number (int): tournament number to translate Returns: name (str): name of the tournament or `None` if unknown. Examples: >>> NumerAPI().tournament_num...
python
{ "resource": "" }
q245753
NumerAPI.tournament_name2number
train
def tournament_name2number(self, name): """Translate tournament name to tournament number. Args: name (str): tournament name to translate Returns: number (int): number of the tournament or `None` if unknown. Examples: >>> NumerAPI().tournament_name2...
python
{ "resource": "" }
q245754
staking_leaderboard
train
def staking_leaderboard(round_num=0, tournament=1): """Retrieves the staking competition leaderboard for the given round."""
python
{ "resource": "" }
q245755
rankings
train
def rankings(limit=20, offset=0): """Get the overall rankings."""
python
{ "resource": "" }
q245756
submission_filenames
train
def submission_filenames(round_num=None, tournament=None): """Get filenames of your submissions""" click.echo(prettify(
python
{ "resource": "" }
q245757
install_bootstrapped_files
train
def install_bootstrapped_files(nb_path=None, server_config=True, DEBUG=False): """ Installs javascript and exporting server extensions in Jupyter notebook. Args: nb_path (string): Path to notebook module. server_config (boolean): Install exporting server extensions. DEBUG (boolean):...
python
{ "resource": "" }
q245758
ipynb_file_name
train
def ipynb_file_name(params): """ Returns OS path to notebook based on route parameters. """ global notebook_dir p = notebook_dir +
python
{ "resource": "" }
q245759
radiance2tb
train
def radiance2tb(rad, wavelength): """ Get the Tb from the radiance using the Planck function rad: Radiance in SI
python
{ "resource": "" }
q245760
RadTbConverter._getsatname
train
def _getsatname(self): """ Get the satellite name used in the rsr-reader, from the platform and number """ if self.platform_name.startswith("Meteosat"): return self.platform_name else:
python
{ "resource": "" }
q245761
RadTbConverter.make_tb2rad_lut
train
def make_tb2rad_lut(self, filepath, normalized=True): """Generate a Tb to radiance look-up table""" tb_ = np.arange(TB_MIN, TB_MAX, self.tb_resolution)
python
{ "resource": "" }
q245762
RadTbConverter.radiance2tb
train
def radiance2tb(self, rad): """ Get the Tb from the radiance using the Planck function and the central wavelength of the band rad: Radiance in SI units
python
{ "resource": "" }
q245763
SeviriRadTbConverter.radiance2tb
train
def radiance2tb(self, rad): """Get the Tb from the radiance using the simple non-linear regression method. rad: Radiance in units = 'mW/m^2 sr^-1 (cm^-1)^-1' """ # # Tb = C2 * νc/{α * log[C1*νc**3 / L + 1]} - β/α # # C1 = 2 * h * c**2 and C2 = hc/k ...
python
{ "resource": "" }
q245764
SeviriRadTbConverter.tb2radiance
train
def tb2radiance(self, tb_, **kwargs): """Get the radiance from the Tb using the simple non-linear regression method. SI units of course! """ # L = C1 * νc**3 / (exp (C2 νc / [αTb + β]) − 1) # # C1 = 2 * h * c**2 and C2 = hc/k # lut = kwargs.get('lut', None...
python
{ "resource": "" }
q245765
RelativeSpectralResponse._get_rsr_data_version
train
def _get_rsr_data_version(self): """Check the version of the RSR data from the version file in the RSR directory """ rsr_data_version_path = os.path.join(self.rsr_dir, RSR_DATA_VERSION_FILENAME) if not os.path.exists(rsr_data_version_path):
python
{ "resource": "" }
q245766
RelativeSpectralResponse._check_instrument
train
def _check_instrument(self): """Check and try fix instrument name if needed""" instr = INSTRUMENTS.get(self.platform_name, self.instrument.lower()) if instr != self.instrument.lower():
python
{ "resource": "" }
q245767
RelativeSpectralResponse._get_filename
train
def _get_filename(self): """Get the rsr filname from platform and instrument names, and download if not available. """ self.filename = expanduser( os.path.join(self.rsr_dir, 'rsr_{0}_{1}.h5'.format(self.instrument, ...
python
{ "resource": "" }
q245768
RelativeSpectralResponse.load
train
def load(self): """Read the internally formatet hdf5 relative spectral response data""" 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.descri...
python
{ "resource": "" }
q245769
RelativeSpectralResponse.integral
train
def integral(self, bandname): """Calculate the integral of the spectral response function for each detector. """ intg = {}
python
{ "resource": "" }
q245770
RelativeSpectralResponse.convert
train
def convert(self): """Convert spectral response functions from wavelength to wavenumber""" from pyspectral.utils import (convert2wavenumber, get_central_wave) if self._wavespace == WAVE_LENGTH: rsr, info = convert2wavenumber(self.rsr) for band in rsr.keys(): ...
python
{ "resource": "" }
q245771
InstrumentRSR._get_options_from_config
train
def _get_options_from_config(self): """Get configuration settings from configuration file""" options = get_config() self.output_dir = options.get('rsr_dir', './')
python
{ "resource": "" }
q245772
InstrumentRSR._get_bandfilenames
train
def _get_bandfilenames(self): """Get the instrument rsr filenames""" for band in self.bandnames: LOG.debug("Band = %s", str(band)) self.filenames[band] = os.path.join(self.path, self.options[self.platform_name + '-' + ...
python
{ "resource": "" }
q245773
blackbody_rad2temp
train
def blackbody_rad2temp(wavelength, radiance): """Derive brightness temperatures from radiance using the Planck function. Wavelength space. Assumes SI units as input and returns temperature in Kelvin """ mask = False if np.isscalar(radiance): rad = np.array([radiance, ], dtype='float64'...
python
{ "resource": "" }
q245774
blackbody_wn_rad2temp
train
def blackbody_wn_rad2temp(wavenumber, radiance): """Derive brightness temperatures from radiance using the Planck function. Wavenumber space""" if np.isscalar(radiance): rad = np.array([radiance, ], dtype='float64') else: rad = np.array(radiance, dtype='float64') if np.isscalar(wav...
python
{ "resource": "" }
q245775
get_central_wave
train
def get_central_wave(wavl, resp): """Calculate the central wavelength or the central
python
{ "resource": "" }
q245776
generate_seviri_file
train
def generate_seviri_file(seviri, platform_name): """Generate the pyspectral internal common format relative response function file for one SEVIRI """ import h5py filename = os.path.join(seviri.output_dir, "rsr_seviri_{0}.h5".format(platform_name)) sat_name = platfor...
python
{ "resource": "" }
q245777
Seviri.convert2wavenumber
train
def convert2wavenumber(self): """Convert from wavelengths to wavenumber""" for chname in self.rsr.keys(): elems = [k for k in self.rsr[chname].keys()] for sat in elems: if sat == "wavelength": LOG.debug("Get the wavenumber from the wavelength: ...
python
{ "resource": "" }
q245778
Seviri.get_centrals
train
def get_centrals(self): """Get the central wavenumbers or central wavelengths of all channels, depending on the given 'wavespace' """ result = {} for chname in self.rsr.keys(): result[chname] = {} if self.wavespace == "wavelength": x__ = se...
python
{ "resource": "" }
q245779
AbiRSR._load
train
def _load(self, scale=1.0): """Load the ABI relative spectral responses """ LOG.debug("File: %s", str(self.requested_band_filename)) data = np.genfromtxt(self.requested_band_filename, unpack=True, names=['wavelength', ...
python
{ "resource": "" }
q245780
SolarIrradianceSpectrum.convert2wavenumber
train
def convert2wavenumber(self): """ Convert from wavelengths to wavenumber. Units: Wavelength: micro meters (1e-6 m) Wavenumber: cm-1
python
{ "resource": "" }
q245781
SolarIrradianceSpectrum._load
train
def _load(self): """Read the tabulated spectral irradiance data from file"""
python
{ "resource": "" }
q245782
SolarIrradianceSpectrum.solar_constant
train
def solar_constant(self): """Calculate the solar constant""" if self.wavenumber is not None: return np.trapz(self.irradiance, self.wavenumber) elif self.wavelength is not None:
python
{ "resource": "" }
q245783
SolarIrradianceSpectrum.inband_solarflux
train
def inband_solarflux(self, rsr, scale=1.0, **options): """Derive the inband solar flux for a given instrument relative spectral response valid for an earth-sun distance of one
python
{ "resource": "" }
q245784
SolarIrradianceSpectrum.inband_solarirradiance
train
def inband_solarirradiance(self, rsr, scale=1.0, **options): """Derive the inband solar irradiance for a given instrument relative spectral response valid for an earth-sun distance
python
{ "resource": "" }
q245785
SolarIrradianceSpectrum._band_calculations
train
def _band_calculations(self, rsr, flux, scale, **options): """Derive the inband solar flux or inband solar irradiance for a given instrument relative spectral response valid for an earth-sun distance of one AU. rsr: Relative Spectral Response (one detector only) Dictionary with ...
python
{ "resource": "" }
q245786
AhiRSR._load
train
def _load(self, filename=None): """Load the Himawari AHI RSR data for the band requested """ if not filename: filename = self.filename wb_ = open_workbook(filename) self.rsr = {} sheet_names = [] for sheet in wb_.sheets(): if sheet.name in...
python
{ "resource": "" }
q245787
plot_band
train
def plot_band(plt_in, band_name, rsr_obj, **kwargs): """Do the plotting of one band""" if 'platform_name_in_legend' in kwargs: platform_name_in_legend = kwargs['platform_name_in_legend'] else: platform_name_in_legend = False detectors = rsr_obj.rsr[band_name].keys() # for det in det...
python
{ "resource": "" }
q245788
convert2wavenumber
train
def convert2wavenumber(rsr): """ Take rsr data set with all channels and detectors for an instrument each with a set of wavelengths and normalised responses and convert to wavenumbers and responses :rsr: Relative Spectral Response function (all bands) Returns: :retv: Relative Spectral Res...
python
{ "resource": "" }
q245789
get_bandname_from_wavelength
train
def get_bandname_from_wavelength(sensor, wavelength, rsr, epsilon=0.1, multiple_bands=False): """Get the bandname from h5 rsr provided the approximate wavelength.""" # channel_list = [channel for channel in rsr.rsr if abs( # rsr.rsr[channel]['det-1']['central_wavelength'] - wavelength) < epsilon] chdis...
python
{ "resource": "" }
q245790
download_rsr
train
def download_rsr(**kwargs): """Download the pre-compiled hdf5 formatet relative spectral response functions from the internet """ # import tarfile import requests TQDM_LOADED = True try: from tqdm import tqdm except ImportError: TQDM_LOADED = False dest_dir = k...
python
{ "resource": "" }
q245791
download_luts
train
def download_luts(**kwargs): """Download the luts from internet.""" # import tarfile import requests TQDM_LOADED = True try: from tqdm import tqdm except ImportError: TQDM_LOADED = False dry_run = kwargs.get('dry_run', False) if 'aerosol_type' in kwargs: if ...
python
{ "resource": "" }
q245792
get_logger
train
def get_logger(name): """Return logger with null handle """ log = logging.getLogger(name) if not
python
{ "resource": "" }
q245793
AatsrRSR._load
train
def _load(self, filename=None): """Read the AATSR rsr data""" if not filename: filename = self.aatsr_path wb_ = open_workbook(filename) for sheet in wb_.sheets(): ch_name = sheet.name.strip() if ch_name == 'aatsr_' + self.bandname: d...
python
{ "resource": "" }
q245794
OliRSR._load
train
def _load(self, scale=0.001): """Load the Landsat OLI relative spectral responses """ with open_workbook(self.path) as wb_: for sheet in wb_.sheets(): if sheet.name in ['Plot of AllBands', ]: continue ch_name = OLI_BAND_NAMES.get(s...
python
{ "resource": "" }
q245795
MetImageRSR._load
train
def _load(self, scale=1.0): """Load the MetImage RSR data for the band requested""" data = np.genfromtxt(self.requested_band_filename, unpack=True, names=['wavenumber', 'response'], ...
python
{ "resource": "" }
q245796
Calculator.emissive_part_3x
train
def emissive_part_3x(self, tb=True): """Get the emissive part of the 3.x band""" try: # Emissive part: self._e3x = self._rad3x_t11 * (1 - self._r3x) # Unsure how much sense it makes to apply the co2 correction term here!? # FIXME! # self._e3x *...
python
{ "resource": "" }
q245797
OlciRSR._load
train
def _load(self, scale=0.001): """Load the OLCI relative spectral responses """ ncf = Dataset(self.path, 'r') bandnum = OLCI_BAND_NAMES.index(self.bandname) # cam = 0 # view = 0 # resp = ncf.variables[ # 'spectral_response_function'][bandnum, cam, vie...
python
{ "resource": "" }
q245798
ModisRSR._get_bandfilenames
train
def _get_bandfilenames(self): """Get the MODIS rsr filenames""" path = self.path for band in MODIS_BAND_NAMES: bnum = int(band) LOG.debug("Band = %s", str(band)) if self.platform_name == 'EOS-Terra': filename = os.path.join(path, ...
python
{ "resource": "" }
q245799
ModisRSR._load
train
def _load(self): """Load the MODIS RSR data for the band requested""" if self.is_sw or self.platform_name == 'EOS-Aqua': scale = 0.001 else: scale = 1.0
python
{ "resource": "" }