Skip to Main Content

Add custom source

The CS Calculator 2.0 can perform calculations with its pre-built sources, as well as with custom user-inputted sources. To add a custom source:

  1. Click on the Add Custom Source icon in the Source List panel.

    add source icon
  2. The Add Custom Source modal will appear.

    add custom source modal
  3. Fill in the Source Name, Manufacturer, CCT/Color, Lamp Type, Description, and SPD input fields.

    Tip: Only the Source Name and SPD fields are required. The other fields are only used for filtering and organization.

    The Source Name field:

    • Must be unique from any of the other sources.

    The SPD field:

    • Will accept relative or absolute SPDs, and convert them automatically to relative.
    • Will accept any range of wavelengths, but will ultimately cut off anything outside the range 0nmwavelength730nm0nm \leq wavelength \leq 730nm.
    • Will accept any wavelength step size.
    • Must contain at least three data points.
    • Must contain the same number of wavelengths and values.

    If any of these criteria are not met, the Add Source button will be disabled.

    Tip: Use the Toggle SPD Input Type button to be able to enter in wavelengths and values in seperate text boxes.
    toggle spd input type button

Download custom sources as JSON

Your custom sources can be downloaded so you can avoid having to input them every time you revisit the site.

  1. Click the Download Custom Sources as JSON icon in the Source List panel.

    download custom sources as JSON
  2. Save the file from the download window that pops up.

    Tip: This popup window might look slightly different depending on the browser you are using.
    download custom sources as JSON download popup window

    Here is an example of the structure of the resulting file. This is an example of a JSON file containing two sources: a warm source, and a cool source.

    {
      "sources": [
        {
          "id": "Warm Source",
          "manufacturer": "N/A",
          "cct": "4000 K",
          "lamp": "N/A",
          "info": "4000 K CCT, Warm circadian response source.",
          "spd": {
            "wavelength": [...],
            "value": [...]
          },
          "custom": "true"
        },
        {
          "id": "Cool Source",
          "manufacturer": "N/A",
          "cct": "6500 K",
          "lamp": "N/A",
          "info": "6500 K, cool response source.",
          "spd": {
            "wavelength": [...],
            "value": [...] 
          },
          "custom": "true"
        }
      ]
    }
    
    Tip: If the resulting Source object in the downloaded JSON file is empty, check to make sure you've added one or more custom sources.

    To learn more about JSON, visit the JSON site, or W3Schools

Upload custom sources from JSON

Once you've downloaded your custom sources as JSON, you can upload those sources back into the calculator without the hassle of manual input.

  1. Click the Upload Custom Sources from JSON icon in the Source List panel.

    upload custom sources as JSON icon
  2. An Upload Custom Sources from JSON modal will appear, click Browse... and select the JSON sources you wish to upload.

    Tip: You can select and upload any number of JSON files at one time.
    Warning: Sources must have a unique id. If two or more of the sources you wish to upload share the same id, they will be ignored.
    upload custom sources as JSON modal
  3. Once you've selected the JSON files you wish to upload, click the Upload Sources button.

    upload sources button
  4. If the files you uploaded are valid, you will see your custom sources appear in the Source List panel and they will automatically be added to the Selected Sources panel in the Calculations pane.

    uploaded sources added to selected sources panel

Edit a Custom Source

Editing a custom source from within the CS Calculator 2.0 can be helpful so you don't have to upload an entirely new source everytime you want to make a change.

  1. Click the Edit Source icon that appears in the Source List panel next to all custom sources.

    edit source icon
  2. Adjust any input fields in the Edit Custom Source modal that appear and click Edit Source. These input fields are the same as when adding a custom source.

    edit source modal

Download metrics as text

Downloading the combined output metrics as text can be helpful in translating them into your own work, such as copy and pasting them into a Microsoft Excel spreadsheet.

  1. Click the Download Metrics as Text icon in the Metrics panel.

    download metrics as text icon
  2. Save the file from the download window that pops up.

    Tip: This popup window might look slightly different depending on the browser you are using.
    download metrics popup

    Here is an example of the structure of the resulting file.

    CS  0.206
    CLA 2.0 161
    Illuminance 200
    Irradiance  9.7548e-1
    Photon Flux 3.0397e+18
    EML 110
    CCT 2857
    Duv 0.000
    CRI 100.0
    GAI 53.3
    Chromaticity Coordinates    (0.4475, 0.4075)
    CIE S-cone Irradiance   5.0839e-2
    CIE M-cone Irradiance   2.3494e-1
    CIE L-cone Irradiance   3.3137e-1
    CIE Rhodopic Irradiance 1.6617e-1
    CIE Melanopic Irradiance    1.3151e-1
    
    Warning: Because of the way the web outputs this text content, it will not copy/paste nicely into Microsoft Excel; the resulting file from the download will, however.

Download combined SPDs as text

Downloading the combined SPDs as text can be helpful in translating them into your own work, such as copy and pasting them into a Microsoft Excel spreadsheet.

  1. Click the Download Combined SPDs as Text icon in the Combined Source SPDs panel.

    download combined spds as text icon
  2. Choose whether to Download Relative SPD or Download Absolute SPD from the dropdown.

    download relative vs absolute spd dropdown
  3. Save the file from the download window that pops up.

    Tip: This popup window might look slightly different depending on the browser you are using.
    download combined spd popup

    Here is an example of the structure of the resulting file.

    380 0.0000013293803216772215
    382 0.000001388033376605896
    384 0.0000014484251156793788
    386 0.000001510573695104725
    388 0.0000015744964791381182
    ...
    
    Warning: Because of the way the web outputs this text content, it will not copy/paste nicely into Microsoft Excel; the resulting file from the download will, however.

Download all calculations as JSON

Should you want to experiment with the CS Calculator 2.0 data in your own programmatic work, you can download all the calculation data into a single JSON file.

  1. Click the Download All Calculations as JSON icon in the Calculations tab.

    download all calculations as json icon
  2. Save the file from the download window that pops up.

    download all calculations popup

    Here is an example of the structure of the resulting file.

    {
      "version": "2.0.0",
      "date": "Fri Jul 16 2021 02:04:18 GMT-0400 (Eastern Daylight Time)",
      "sources": {
        "CIE A: Standard Incandescent": {
          "info": {
            "id": "CIE A: Standard Incandescent",
            "manufacturer": "Other",
            "cct": "2700 K",
            "lamp": "Incandescent",
            "desc": "CIE standard illuminant A ...",
            "spd": {
              "wavelengths": [...],
              "values": [...]
            }
          },
          "lux": "200"
        }
      },
      "input_variables": {
        "exposure_duration": "1",
        "distribution_scaler": "1"
      },
      "combined_metrics": {
        "cs_2.0": "0.206",
        "cla_2.0": "161",
        "illuminance": "200",
        "irradiance": "9.7548e-1",
        "flux": "3.0397e+18",
        "eml": "110",
        "cct": "2857",
        "duv": "0.000",
        "cri": "100.0",
        "gai": "53.3",
        "chromaticity_coordinates": "(0.4475, 0.4075)",
        "cie_s-cone-irradiance": "5.0839e-2",
        "cie_m-cone_irradiance": "2.3494e-1",
        "cie_l-cone_irradiance": "3.3137e-1",
        "cie_rhodopic_irradiance": "1.6617e-1",
        "cie_melanopic_irradiance": "1.3151e-1"
      },
      "combined_spd": {
        "relative": {
          "wavelengths": [...],
          "values": [...]
        },
        "absolute": {
          "wavelengths": [...],
          "values": [...]
        }
      }
    }
    

    To learn more about JSON, visit the JSON site, or W3Schools

Share

Help us spread this information.

Edit

See a typo? Did we miss something?

Edit this page
Feedback

Something not working right? Want to make a suggestion?

Submit an issue
Mount Sinai Health Logo

© 2021 Light and Health Research Center