Utility functions for spectroscopic data.

source

load_toy_mir

 load_toy_mir ()

Load the toy MIR dataset.

Exported source
toy_mir_url = 'https://gist.githubusercontent.com/franckalbinet/a7476d0413e88bcc162c553e43f182fa/raw/a45dc573eec558b019909bdd1830fbb207511fcb/mir-spectra-sample.csv'
toy_noisy_mir_url = 'https://gist.githubusercontent.com/franckalbinet/3e4e16f592175edad724c22841eb88dd/raw/c6a3f83c0146fbdc826aa4e9c1c448120a281a2e/rt_mir_bruker.csv'
Exported source
def load_toy_mir():
    """Load the toy MIR dataset."""
    df_mir = pd.read_csv(toy_mir_url)
    ws = df_mir.columns.astype(int).to_numpy()
    X = df_mir.values
    return X, ws
X, ws = load_toy_mir()
print(f'X shape: {X.shape}, First 5 wavenumbers: {ws[:5]}')
X shape: (50, 1701), First 5 wavenumbers: [600 602 604 606 608]

source

load_toy_noisy_mir

 load_toy_noisy_mir ()

*Load the toy noisy MIR dataset.

Scans acquired in the context of a K spiking experiment: In-progress publication.*

Exported source
def load_toy_noisy_mir():
    """
    Load the toy noisy MIR dataset.
    
    Scans acquired in the context of a K spiking experiment: In-progress publication.
    """
    df = pd.read_csv(toy_noisy_mir_url)
    sample_ids = df.sample_id.values
    wavenumbers = df.columns[1:].to_numpy().astype(float)
    spectra = df.iloc[:, 1:].to_numpy()
    return spectra, wavenumbers, sample_ids
X, wns, smp_id = load_toy_noisy_mir()
print(f'X shape: {X.shape}, First 5 wavenumbers: {wns[:5]}')
X shape: (48, 3315), First 5 wavenumbers: [599.91153162 600.93702142 601.96251122 602.98800102 604.01349081]