### Installation Source: https://context7.com/tlambert03/fpbasepy/llms.txt Install the fpbase library using pip. ```APIDOC ## Installation ```bash pip install fpbase ``` ``` -------------------------------- ### Get Microscope Configuration by ID Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetch a microscope configuration by its ID to get detailed information about its optical components, including filters, cameras, and light sources. Useful for understanding experimental setups. ```python import fpbase # Fetch a microscope by its ID scope = fpbase.get_microscope("i6WL2W") print(f"Microscope: {scope.name}") print(f"Number of optical configs: {len(scope.opticalConfigs)}") # Explore optical configurations for config in scope.opticalConfigs[:3]: print(f"\nConfig: {config.name}") # List filters in this config for fp in config.filters: print(f" {fp.path}: {fp.filter.name}") # Camera info if config.camera: print(f" Camera: {config.camera.name}") # Light source info if config.light: print(f" Light: {config.light.name}") ``` ```text Microscope: Example Widefield (Sedat) Number of optical configs: 9 Config: Widefield Blue EX: Chroma ET395/25x BS: Chroma T425lpxr EM: Chroma ET460/50m Camera: Andor Zyla 4.2 PLUS Light: SOLA 395 ``` -------------------------------- ### Install fpbase Python Package Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md Install the fpbase library using pip. This command is used for setting up the package in your Python environment. ```sh pip install fpbase ``` -------------------------------- ### Get a Fluorophore by Name (DAPI Example) Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md Retrieves a single fluorophore object by its name, demonstrated with 'DAPI'. This function can return either a protein or a dye. ```python fpbase.get_fluorophore("DAPI") ``` ```python Fluorophore( name='DAPI', id='15', default_state=State( id=15, name='DAPI', exMax=359.0, emMax=461.0, emhex='', exhex='', ext_coeff=None, qy=None, spectra=[ Spectrum(id=7754, subtype='AB', owner_filter=None, owner_camera=None, owner_light=None), Spectrum(id=222, subtype='EX', owner_filter=None, owner_camera=None, owner_light=None), Spectrum(id=223, subtype='EM', owner_filter=None, owner_camera=None, owner_light=None) ], lifetime=None ) ) ``` -------------------------------- ### Define Basic Optical Configuration with Multiple Filters Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md This snippet defines a basic optical configuration with excitation, beamsplitter, and emission filters, along with camera and light source details. It is part of a larger system setup. ```python OpticalConfig( name='Widefield', filters=[ FilterPlacement( path='EX', filter=Filter( id=39, name='Chroma ET470/24x', spectrum=Spectrum(id=399, subtype='BX', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='BS', filter=Filter( id=62, name='Chroma 59022bs', spectrum=Spectrum(id=385, subtype='BS', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='EM', filter=Filter( id=569, name='Semrock FF03-525/50', spectrum=Spectrum(id=905, subtype='BP', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ) ], camera=Camera( id=4, name='Andor Zyla 4.2 PLUS', spectrum=Spectrum(id=1328, subtype='QE', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), light=LightSource( id=9, name='SOLA 395', spectrum=Spectrum(id=394, subtype='PD', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), laser=None ) ``` -------------------------------- ### Get Microscope Configuration Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetches a microscope configuration by ID, returning detailed information about optical configurations including filters, cameras, light sources, and their spectral properties. ```APIDOC ## Get Microscope Configuration Fetches a microscope configuration by ID, returning detailed information about optical configurations including filters, cameras, light sources, and their spectral properties. ```python import fpbase # Fetch a microscope by its ID scope = fpbase.get_microscope("i6WL2W") print(f"Microscope: {scope.name}") print(f"Number of optical configs: {len(scope.opticalConfigs)}") # Explore optical configurations for config in scope.opticalConfigs[:3]: print(f"\nConfig: {config.name}") # List filters in this config for fp in config.filters: print(f" {fp.path}: {fp.filter.name}") # Camera info if config.camera: print(f" Camera: {config.camera.name}") # Light source info if config.light: print(f" Light: {config.light.name}") # Output: # Microscope: Example Widefield (Sedat) # Number of optical configs: 9 # # Config: Widefield Blue # EX: Chroma ET395/25x # BS: Chroma T425lpxr # EM: Chroma ET460/50m # Camera: Andor Zyla 4.2 PLUS # Light: SOLA 395 ``` ``` -------------------------------- ### Get Filter by Name Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetch an optical filter by its name to retrieve its properties, including bandcenter, bandwidth, and transmission spectrum data. Essential for optical path planning. ```python import fpbase # Fetch a bandpass emission filter filt = fpbase.get_filter("Chroma ET525/50m") print(f"Filter: {filt.name}") print(f"ID: {filt.id}") print(f"Manufacturer: {filt.manufacturer}") print(f"Band Center: {filt.bandcenter}") print(f"Bandwidth: {filt.bandwidth}") # Access transmission spectrum data spectrum = filt.spectrum print(f"Spectrum Type: {spectrum.subtype}") print(f"Spectrum data points: {len(spectrum.data)}") ``` -------------------------------- ### Get Filter by Name Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetches an optical filter by name, returning filter properties including bandcenter, bandwidth, and full spectral transmission data. ```APIDOC ## Get Filter by Name Fetches an optical filter by name, returning filter properties including bandcenter, bandwidth, and full spectral transmission data. ```python import fpbase # Fetch a bandpass emission filter filt = fpbase.get_filter("Chroma ET525/50m") print(f"Filter: {filt.name}") print(f"ID: {filt.id}") print(f"Manufacturer: {filt.manufacturer}") print(f"Band Center: {filt.bandcenter}") print(f"Bandwidth: {filt.bandwidth}") # Access transmission spectrum data spectrum = filt.spectrum print(f"Spectrum Type: {spectrum.subtype}") print(f"Spectrum data points: {len(spectrum.data)}") ``` ``` -------------------------------- ### Get Fluorophore by Name Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetch a fluorescent protein or dye by its name, slug, or ID. Access spectral and photophysical properties. Provides suggestions for misspelled names. ```python import fpbase # Fetch a fluorescent protein mcherry = fpbase.get_fluorophore("mCherry") print(f"Name: {mcherry.name}") print(f"ID: {mcherry.id}") print(f"Excitation Max: {mcherry.default_state.exMax} nm") print(f"Emission Max: {mcherry.default_state.emMax} nm") print(f"Quantum Yield: {mcherry.default_state.qy}") print(f"Extinction Coefficient: {mcherry.default_state.ext_coeff} M^-1 cm^-1") # Access spectral data ex_spectrum = mcherry.default_state.excitation_spectrum em_spectrum = mcherry.default_state.emission_spectrum print(f"Excitation spectrum data points: {len(ex_spectrum.data)}") # Fetch a dye dapi = fpbase.get_fluorophore("DAPI") print(f"DAPI Ex/Em: {dapi.default_state.exMax}/{dapi.default_state.emMax} nm") ``` ```text Name: mCherry ID: ZERB6 Excitation Max: 587.0 nm Emission Max: 610.0 nm Quantum Yield: 0.22 Extinction Coefficient: 72000.0 M^-1 cm^-1 Excitation spectrum data points: 121 DAPI Ex/Em: 359.0/461.0 nm ``` -------------------------------- ### Microscope Object Structure Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md The `get_microscope` function returns a Microscope object containing optical configurations, filters, cameras, and light sources. Inspect this structure to understand the microscope's setup. ```python Microscope( id='i6WL2WdgcDMgJYtPrpZcaJ', name='Example Widefield (Sedat)', opticalConfigs=[ OpticalConfig( name='Widefield Blue', filters=[ FilterPlacement( path='EX', filter=Filter( id=52, name='Chroma ET395/25x', spectrum=Spectrum(id=375, subtype='BX', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='BS', filter=Filter( id=10, name='Chroma T425lpxr', spectrum=Spectrum(id=333, subtype='LP', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='EM', filter=Filter( id=47, name='Chroma ET460/50m', spectrum=Spectrum(id=370, subtype='BM', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ) ], camera=Camera( id=4, name='Andor Zyla 4.2 PLUS', spectrum=Spectrum(id=1328, subtype='QE', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), light=LightSource( id=9, name='SOLA 395', spectrum=Spectrum(id=394, subtype='PD', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), laser=None ), OpticalConfig( name='Widefield Dual FRET', filters=[ FilterPlacement( path='EX', filter=Filter( id=63, name='Lumencor 470/24x', spectrum=Spectrum(id=399, subtype='BX', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='BS', filter=Filter( id=62, name='Chroma 59022bs', spectrum=Spectrum(id=385, subtype='BS', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='EM', filter=Filter( id=689, name='Semrock FF02-641/75', spectrum=Spectrum(id=1025, subtype='BP', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ) ], camera=Camera( id=4, name='Andor Zyla 4.2 PLUS', spectrum=Spectrum(id=1328, subtype='QE', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), light=LightSource( id=9, name='SOLA 395', spectrum=Spectrum(id=394, subtype='PD', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), laser=None ), OpticalConfig( name='Widefield Dual Green', filters=[ FilterPlacement( path='EX', filter=Filter( id=63, name='Lumencor 470/24x', ``` -------------------------------- ### Get a Fluorophore by Name Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md Retrieves a single fluorophore object by its name. Use `get_protein()` if you specifically need a protein and want to ensure the response model is `fpbase.models.Protein`. ```python import fpbase fpbase.get_fluorophore("mCherry") ``` ```python Protein( name='mCherry', id='ZERB6', default_state=State( id=336, name='mCherry', exMax=587.0, emMax=610.0, emhex='#f70000', exhex='#ff4600', ext_coeff=72000.0, qy=0.22, spectra=[ Spectrum(id=79, subtype='EX', owner_filter=None, owner_camera=None, owner_light=None), Spectrum(id=80, subtype='EM', owner_filter=None, owner_camera=None, owner_light=None), Spectrum(id=158, subtype='A_2P', owner_filter=None, owner_camera=None, owner_light=None) ], lifetime=1.4 ), seq='MVSKGEEDNMAIIKEFMRFKVHMEGSVNGHEFEIEGEGEGRPYEGTQTAKLKVTKGGPLPFAWDILSPQFMYGSKAYVKHPADIPDYLKLSFPEGFKWERVMNFEDGGVVTVTQDSSLQDGEFIYKVKLRGTNFPSDGPVMQKKTMGWEASSERMYPEDGALKGEIKQRLKLKDGGHYDAEVKTTYKAKKPVQLPGAYNVNIKLDITSHNEDYTIVEQYERAEGRHSTGGMDELYK', pdb=['2H5Q'], genbank='AAV52164', uniprot='X5DSL3', agg=, switch_type=, primary_reference=Reference(doi='10.1038/nbt1037', url='https://doi.org/10.1038/nbt1037'), references=[ Reference(doi='10.1038/nbt1037', url='https://doi.org/10.1038/nbt1037'), Reference(doi='10.1021/bi060773l', url='https://doi.org/10.1021/bi060773l'), Reference(doi='10.1038/nmeth1062', url='https://doi.org/10.1038/nmeth1062'), Reference(doi='10.1038/nmeth.1596', url='https://doi.org/10.1038/nmeth.1596'), Reference(doi='10.1038/nmeth.1955', url='https://doi.org/10.1038/nmeth.1955'), Reference(doi='10.1091/mbc.e16-01-0063', url='https://doi.org/10.1091/mbc.e16-01-0063'), Reference(doi='10.1038/s41598-017-12212-x', url='https://doi.org/10.1038/s41598-017-12212-x'), Reference(doi='10.1038/s41598-018-28858-0', url='https://doi.org/10.1038/s41598-018-28858-0'), Reference(doi='10.1002/pld3.112', url='https://doi.org/10.1002/pld3.112'), Reference(doi='10.1371/journal.pone.0219886', url='https://doi.org/10.1371/journal.pone.0219886'), Reference(doi='10.1073/pnas.2017379117', url='https://doi.org/10.1073/pnas.2017379117'), Reference(doi='10.1038/s41467-023-40647-6', url='https://doi.org/10.1038/s41467-023-40647-6') ] ) ``` -------------------------------- ### Get Protein with Full Details Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetch a protein specifically, including its sequence, PDB IDs, GenBank and UniProt IDs, oligomerization state, and references. Useful for detailed protein analysis. ```python import fpbase # Fetch EGFP with full protein details egfp = fpbase.get_protein("EGFP") print(f"Name: {egfp.name}") print(f"Sequence: {egfp.seq[:50]}...") print(f"PDB IDs: {egfp.pdb}") print(f"GenBank: {egfp.genbank}") print(f"UniProt: {egfp.uniprot}") print(f"Oligomerization: {egfp.agg}") print(f"Switch Type: {egfp.switch_type}") # Access references if egfp.primary_reference: print(f"Primary Reference: {egfp.primary_reference.url}") print(f"Total References: {len(egfp.references)}") # Fetch photoconvertible protein meos = fpbase.get_protein("mEos3.2") print(f"mEos3.2 states: {[s.name for s in meos.states]}") ``` ```text Name: EGFP Sequence: MVSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKL... PDB IDs: ['2Y0G', '4EUL', ...] GenBank: AAB02574 UniProt: P42212 Oligomerization: Olig.MONOMER Switch Type: SwitchType.BASIC Primary Reference: https://doi.org/10.1038/nbt1172 Total References: 47 ``` -------------------------------- ### Get Fluorophore by Name Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetches a fluorophore (protein or dye) by name, slug, or ID. Returns a Fluorophore or Protein object with full spectral data and photophysical properties. Provides helpful suggestions if the name is misspelled. ```APIDOC ## Get Fluorophore by Name Fetches a fluorophore (protein or dye) by name, slug, or ID. Returns a `Fluorophore` or `Protein` object with full spectral data and photophysical properties. Provides helpful suggestions if the name is misspelled. ```python import fpbase # Fetch a fluorescent protein mcherry = fpbase.get_fluorophore("mCherry") print(f"Name: {mcherry.name}") print(f"ID: {mcherry.id}") print(f"Excitation Max: {mcherry.default_state.exMax} nm") print(f"Emission Max: {mcherry.default_state.emMax} nm") print(f"Quantum Yield: {mcherry.default_state.qy}") print(f"Extinction Coefficient: {mcherry.default_state.ext_coeff} M^-1 cm^-1") # Access spectral data ex_spectrum = mcherry.default_state.excitation_spectrum em_spectrum = mcherry.default_state.emission_spectrum print(f"Excitation spectrum data points: {len(ex_spectrum.data)}") # Fetch a dye dapi = fpbase.get_fluorophore("DAPI") print(f"DAPI Ex/Em: {dapi.default_state.exMax}/{dapi.default_state.emMax} nm") # Output: # Name: mCherry # ID: ZERB6 # Excitation Max: 587.0 nm # Emission Max: 610.0 nm # Quantum Yield: 0.22 # Extinction Coefficient: 72000.0 M^-1 cm^-1 # Excitation spectrum data points: 121 # DAPI Ex/Em: 359.0/461.0 nm ``` ``` -------------------------------- ### Get Protein with Full Details Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetches a protein specifically (not dyes), returning a `Protein` object with additional fields like sequence, PDB IDs, GenBank accession, UniProt ID, oligomerization state, and literature references. ```APIDOC ## Get Protein with Full Details Fetches a protein specifically (not dyes), returning a `Protein` object with additional fields like sequence, PDB IDs, GenBank accession, UniProt ID, oligomerization state, and literature references. ```python import fpbase # Fetch EGFP with full protein details egfp = fpbase.get_protein("EGFP") print(f"Name: {egfp.name}") print(f"Sequence: {egfp.seq[:50]}...") print(f"PDB IDs: {egfp.pdb}") print(f"GenBank: {egfp.genbank}") print(f"UniProt: {egfp.uniprot}") print(f"Oligomerization: {egfp.agg}") print(f"Switch Type: {egfp.switch_type}") # Access references if egfp.primary_reference: print(f"Primary Reference: {egfp.primary_reference.url}") print(f"Total References: {len(egfp.references)}") # Fetch photoconvertible protein meos = fpbase.get_protein("mEos3.2") print(f"mEos3.2 states: {[s.name for s in meos.states]}") # Output: # Name: EGFP # Sequence: MVSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKL... # PDB IDs: ['2Y0G', '4EUL', ...] # GenBank: AAB02574 # UniProt: P42212 # Oligomerization: Olig.MONOMER # Switch Type: SwitchType.BASIC # Primary Reference: https://doi.org/10.1038/nbt1172 # Total References: 47 ``` ``` -------------------------------- ### Initialize and Use FPbaseClient Source: https://context7.com/tlambert03/fpbasepy/llms.txt Use the singleton instance for connection pooling and automatic response caching. Custom instances can be created if specific configuration is required. ```python import fpbase from fpbase import FPbaseClient # Get singleton instance (recommended) client = FPbaseClient.instance() # All convenience functions use this client internally protein = client.get_protein("mScarlet") print(f"Protein: {protein.name}") # Client caches responses automatically # Second call returns cached result protein2 = client.get_protein("mScarlet") # Create custom client instance if needed custom_client = FPbaseClient() scope = custom_client.get_microscope("i6WL2W") # List functions also available on client available_dyes = client.list_dyes() print(f"Available dyes: {len(available_dyes)}") # Output: # Protein: mScarlet # Available dyes: 400+ ``` -------------------------------- ### Initialize fpbasepy nested objects Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md Used for defining light source and spectrum configurations within the library's data model. ```python spectrum=Spectrum(id=1328, subtype='QE', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), light=LightSource( id=9, name='SOLA 395', spectrum=Spectrum(id=394, subtype='PD', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), laser=None ) ] ) ``` -------------------------------- ### List Available FPBase Resources Source: https://context7.com/tlambert03/fpbasepy/llms.txt Provides functions to list all available items in the FPBase database, categorized by type (fluorophores, proteins, dyes, microscopes, filters, cameras, light sources). Useful for discovering database contents. ```python import fpbase # List all fluorophores (proteins + dyes) all_fluorophores = fpbase.list_fluorophores() print(f"Total fluorophores: {len(all_fluorophores)}") print(f"First 5: {all_fluorophores[:5]}") # List proteins only proteins = fpbase.list_proteins() print(f"\nTotal proteins: {len(proteins)}") # List dyes only dyes = fpbase.list_dyes() print(f"Total dyes: {len(dyes)}") # List microscopes (returns IDs) microscopes = fpbase.list_microscopes() print(f"\nAvailable microscopes: {len(microscopes)}") print(f"First microscope ID: {microscopes[0]}") # List optical equipment filters = fpbase.list_filters() cameras = fpbase.list_cameras() lights = fpbase.list_light_sources() print(f"\nFilters: {len(filters)}, Cameras: {len(cameras)}, Lights: {len(lights)}") ``` -------------------------------- ### Fetch Camera Quantum Efficiency Spectrum by Name Source: https://context7.com/tlambert03/fpbasepy/llms.txt Fetches a camera's quantum efficiency (QE) spectrum by its name. This is useful for calculating detection efficiency across different wavelengths. ```python import fpbase # Fetch camera QE data camera = fpbase.get_camera("Andor Zyla 5.5") print(f"Camera: {camera.name}") print(f"ID: {camera.id}") print(f"Manufacturer: {camera.manufacturer}") # Access QE spectrum qe_spectrum = camera.spectrum print(f"Spectrum Type: {qe_spectrum.subtype}") # QE = Quantum Efficiency print(f"Data points: {len(qe_spectrum.data)}") # Find peak QE max_qe = max(qe_spectrum.data, key=lambda x: x[1]) print(f"Peak QE: {max_qe[1]:.2%} at {max_qe[0]} nm") ``` -------------------------------- ### Fetch Light Source Emission Spectrum by Name Source: https://context7.com/tlambert03/fpbasepy/llms.txt Retrieves a light source's emission spectrum by its name. This is useful for matching excitation wavelengths with fluorophore absorption. ```python import fpbase # Fetch light source spectrum light = fpbase.get_light_source("Lumencor Celesta UV") print(f"Light Source: {light.name}") print(f"ID: {light.id}") # Access emission spectrum spectrum = light.spectrum print(f"Spectrum Type: {spectrum.subtype}") print(f"Data points: {len(spectrum.data)}") ``` -------------------------------- ### Fetch Microscope Info by ID Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md Use `fpbase.get_microscope` to retrieve detailed information about a specific microscope using its ID. This is useful for accessing configuration details programmatically. ```python fpbase.get_microscope("i6WL2W") ``` -------------------------------- ### Access and Analyze Spectral Data Source: https://context7.com/tlambert03/fpbasepy/llms.txt Retrieve excitation and emission spectra as lists of (wavelength, intensity) tuples. These can be used for plotting or finding peak wavelengths. ```python import fpbase # Get protein with spectra protein = fpbase.get_protein("mCherry") state = protein.default_state # Access excitation and emission spectra ex_spec = state.excitation_spectrum em_spec = state.emission_spectrum print(f"Excitation spectrum type: {ex_spec.subtype}") print(f"Emission spectrum type: {em_spec.subtype}") # Spectrum data is list of (wavelength, intensity) tuples ex_data = ex_spec.data # [(wavelength_nm, normalized_intensity), ...] em_data = em_spec.data print(f"Excitation range: {ex_data[0][0]} - {ex_data[-1][0]} nm") print(f"Emission range: {em_data[0][0]} - {em_data[-1][0]} nm") # Find peak wavelengths ex_peak = max(ex_data, key=lambda x: x[1]) em_peak = max(em_data, key=lambda x: x[1]) print(f"Excitation peak: {ex_peak[0]} nm") print(f"Emission peak: {em_peak[0]} nm") # Extract data for plotting (e.g., with matplotlib) wavelengths_ex = [point[0] for point in ex_data] intensities_ex = [point[1] for point in ex_data] # Example: find value at specific wavelength def get_intensity_at_wavelength(spectrum_data, target_wl): for wl, intensity in spectrum_data: if wl >= target_wl: return intensity return 0.0 intensity_at_550 = get_intensity_at_wavelength(em_data, 550) print(f"Emission intensity at 550nm: {intensity_at_550:.3f}") # Output: # Excitation spectrum type: SpectrumType.EX # Emission spectrum type: SpectrumType.EM # Excitation range: 400.0 - 700.0 nm # Emission range: 500.0 - 800.0 nm # Excitation peak: 587.0 nm # Emission peak: 610.0 nm # Emission intensity at 550nm: 0.001 ``` -------------------------------- ### Execute Custom GraphQL Queries Source: https://context7.com/tlambert03/fpbasepy/llms.txt Allows sending custom GraphQL queries to the FPBase API for advanced data retrieval. Requires knowledge of the GraphQL schema, which can be explored via the interactive playground. ```python import fpbase # Get all protein names and sequences data = fpbase.graphql_query("{proteins { name seq } }") proteins = data["data"]["proteins"] print(f"Total proteins: {len(proteins)}") egfp = next(p for p in proteins if p["name"] == "EGFP") print(f"EGFP sequence starts with: {egfp['seq'][:20]}") # Query specific protein by ID query = 'query getProtein($id: String!){ protein(id: $id){ name seq exMax emMax } }' data = fpbase.graphql_query(query, {"id": "R9NL8"}) protein = data["data"]["protein"] print(f"\nProtein: {protein['name']}") # Get microscope optical configs with variables query = """ query getScope($id: String!) { microscope(id: $id) { name opticalConfigs { name filters { path filter { name } } } } } """ data = fpbase.graphql_query(query, {"id": "i6WL2WdgcDMgJYtPrpZcaJ"}) scope = data["data"]["microscope"] print(f"\nMicroscope: {scope['name']}") print(f"Configs: {[c['name'] for c in scope['opticalConfigs'][:3]]}") # Query spectra by category data = fpbase.graphql_query('{ spectra(category: "F") { id owner { name } } }') filter_spectra = data["data"]["spectra"] print(f"\nFilter spectra available: {len(filter_spectra)}") ``` -------------------------------- ### Fetch Filter Spectrum by Name Source: https://context7.com/tlambert03/fpbasepy/llms.txt Retrieves a filter's spectral data by its name. Useful for understanding the transmission properties of optical filters. ```python import fpbase # Fetch a filter semrock = fpbase.get_filter("Semrock FF01-520/35") print(f"Filter: {semrock.name}") print(f"ID: {semrock.id}") print(f"Manufacturer: {semrock.manufacturer}") # Access spectrum data spectrum = semrock.spectrum print(f"Spectrum Type: {spectrum.subtype}") print(f"Spectrum data points: {len(spectrum.data)}") print(f"First data point: {spectrum.data[0]}") ``` -------------------------------- ### Define Widefield Far-Red Optical Configuration Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md This snippet defines a 'Widefield Far-Red' optical configuration. It includes an excitation filter and a beamsplitter. The emission filter definition is incomplete in the provided source. ```python OpticalConfig( name='Widefield Far-Red', filters=[ FilterPlacement( path='EX', filter=Filter( id=445, name='Chroma ET640/30x', spectrum=Spectrum(id=781, subtype='BX', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='BS', filter=Filter( id=6, name='Chroma T660lpxr', ``` -------------------------------- ### Define Widefield Dual Red Optical Configuration Source: https://github.com/tlambert03/fpbasepy/blob/main/README.md This snippet defines a 'Widefield Dual Red' optical configuration. It specifies excitation, beamsplitter, and emission filters, along with the camera and light source used. This configuration is suitable for experiments requiring dual red fluorescence detection. ```python OpticalConfig( name='Widefield Dual Red', filters=[ FilterPlacement( path='EX', filter=Filter( id=67, name='Lumencor 575/25x', spectrum=Spectrum(id=403, subtype='BX', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='BS', filter=Filter( id=62, name='Chroma 59022bs', spectrum=Spectrum(id=385, subtype='BS', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ), FilterPlacement( path='EM', filter=Filter( id=689, name='Semrock FF02-641/75', spectrum=Spectrum(id=1025, subtype='BP', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='', bandcenter=None, bandwidth=None, edge=None ), reflects=False ) ], camera=Camera( id=4, name='Andor Zyla 4.2 PLUS', spectrum=Spectrum(id=1328, subtype='QE', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), light=LightSource( id=9, name='SOLA 395', spectrum=Spectrum(id=394, subtype='PD', owner_filter=None, owner_camera=None, owner_light=None), manufacturer='' ), laser=None ) ``` -------------------------------- ### Interact with Pydantic Data Models Source: https://context7.com/tlambert03/fpbasepy/llms.txt Access API response data through typed Pydantic models. Use these models to inspect protein attributes, state properties, and enumeration types. ```python import fpbase from fpbase.models import ( Protein, Fluorophore, State, Spectrum, Microscope, OpticalConfig, Filter, SpectrumType, Olig, SwitchType ) # Protein model attributes protein = fpbase.get_protein("mVenus") assert isinstance(protein, Protein) # Key Protein fields: # - name: str # - id: str # - seq: Optional[str] - amino acid sequence # - pdb: list[str] - PDB structure IDs # - genbank: Optional[str] - GenBank accession # - uniprot: Optional[str] - UniProt ID # - agg: Optional[Olig] - oligomerization (MONOMER, DIMER, TETRAMER, etc.) # - switch_type: Optional[SwitchType] - BASIC, PHOTOACTIVATABLE, etc. # - default_state: Optional[State] - primary photophysical state # - states: list[State] - all states (for photoswitchable proteins) # - references: list[Reference] - literature references # State model attributes state = protein.default_state # - exMax: Optional[float] - excitation maximum (nm) # - emMax: Optional[float] - emission maximum (nm) # - ext_coeff: Optional[float] - extinction coefficient (M^-1 cm^-1) # - qy: Optional[float] - quantum yield (0-1) # - lifetime: Optional[float] - fluorescence lifetime (ns) # - spectra: list[Spectrum] - spectral data # Spectrum types print(f"Spectrum types: {[e.value for e in SpectrumType]}") # EX=excitation, EM=emission, AB=absorption, A_2P=two-photon # BM/BP/BX=bandpass, BS=beamsplitter, LP=longpass, QE=quantum efficiency # Oligomerization states print(f"Oligomerization types: {[e.value for e in Olig]}") # M=monomer, D=dimer, TD=tandem dimer, WD=weak dimer, T=tetramer # Output: # Spectrum types: ['A_2P', 'BM', 'BP', 'BS', 'BX', 'EM', 'EX', 'LP', 'PD', 'QE', 'AB', 'SP'] # Oligomerization types: ['M', 'D', 'TD', 'WD', 'T'] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.