{"id":23468,"library":"crds","title":"CRDS - Calibration Reference Data System","description":"CRDS (Calibration Reference Data System) manages calibration reference files for HST, JWST, and Roman telescopes. It provides tools for selecting, downloading, and validating reference files. Version 13.1.16 supports Python >=3.7 and is actively maintained with regular releases aligned with telescope operations.","status":"active","version":"13.1.16","language":"python","source_language":"en","source_url":"https://github.com/spacetelescope/crds","tags":["JWST","HST","Roman","calibration","reference files","astronomy"],"install":[{"cmd":"pip install crds","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"HTTP requests to CRDS server","package":"requests","optional":false},{"reason":"FITS file handling and table operations","package":"astropy","optional":true}],"imports":[{"note":"Main module. Submodules like crds.client, crds.core are imported as needed.","symbol":"crds","correct":"import crds"},{"note":"BestReferences is imported from the top-level crds module, not from crds.client.","wrong":"from crds.client import BestReferences","symbol":"BestReferences","correct":"from crds import BestReferences"}],"quickstart":{"code":"import crds\nfrom crds import BestReferences\n\n# Set server URL (optional, defaults to CRDS server)\ncrds.set_server_url(os.environ.get('CRDS_SERVER_URL', 'https://crdsserver.stsci.edu'))\n\n# Get best references for an observation\ncontext = 'jwst_ops.pmap'  # or use a specific context id\nobs = {'INSTRUMENT': 'NIRCam', 'DETECTOR': 'NRCA1', 'FILTER': 'F090W', 'DATE-OBS': '2023-01-01'}\nrefs = BestReferences(context, obs)\nprint(refs.get_references())\n","lang":"python","description":"Basic usage: set server, create BestReferences with a context and observation parameters, then retrieve reference file mappings."},"warnings":[{"fix":"Upgrade to latest crds and use Python 3.7+. If you need Python 2 compatibility, stay on legacy versions (not recommended).","message":"CRDS 11.x dropped Python 2 support. Current versions require Python >=3.7.","severity":"breaking","affected_versions":"<11.0"},{"fix":"Replace calls to crds.getreferences() with BestReferences context manager or direct instantiation.","message":"The function `crds.getreferences()` is deprecated. Use `BestReferences` class instead.","severity":"deprecated","affected_versions":">=10.0"},{"fix":"Set the environment variable CRDS_PATH to a local directory to cache downloaded files. Use CRDS_SERVER_URL to specify a mirror.","message":"CRDS requires internet access to fetch reference files unless you set up a local cache. Without cache, it downloads files on demand.","severity":"gotcha","affected_versions":"all"},{"fix":"Always provide required keys: INSTRUMENT, DETECTOR, DATE-OBS, and any filter/grating/band specific to the instrument. Check instrument documentation.","message":"When using BestReferences, the observation dictionary must include exact header keywords (case-sensitive). Missing keys cause KeyError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade crds to latest: pip install --upgrade crds","cause":"Outdated crds version (before 10.0) that doesn't have BestReferences class.","error":"ImportError: cannot import name 'BestReferences' from 'crds'"},{"fix":"Check network, set CRDS_SERVER_URL to a reachable server (e.g., https://crdsserver.stsci.edu), or use a local mirror.","cause":"No internet access or incorrect CRDS_SERVER_URL. CRDS defaults to public STScI server; if blocked, set a mirror.","error":"crds.core.exceptions.CrdsNetworkError: Unable to connect to CRDS server"},{"fix":"Include all required keys: INSTRUMENT, DETECTOR, DATE-OBS. Example: obs = {'INSTRUMENT': 'NIRCam', 'DETECTOR': 'NRCA1', 'DATE-OBS': '2023-01-01'}","cause":"Observation dictionary missing required key 'INSTRUMENT'.","error":"KeyError: 'INSTRUMENT'"},{"fix":"Use a more recent context (pmap) or check that observation parameters match available reference files. Try context = 'jwst_ops.pmap' for latest.","cause":"No reference file for the given context and observation parameters. Could be obsolete context or incorrect parameters.","error":"crds.core.exceptions.CrdsLookupError: No matching reference file found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}