@bdelab/jscat - v5.3.2
    Preparing search index...

    Function filterItemsByCatParameterAvailability

    • Filters a list of multi-zeta stimuli based on the availability of model parameters for a specific CAT.

      This function takes an array of MultiZetaStimulus objects and a catName as input. It then filters the items based on whether the specified CAT model parameter is present in the item's zeta values. The function returns an object containing two arrays: available and missing. The available array contains items where the specified CAT model parameter is present, while the missing array contains items where the parameter is not present.

      Parameters

      • items: MultiZetaStimulus[]

        An array of MultiZetaStimulus objects representing the stimuli to filter.

      • catName: string

        The name of the CAT model parameter to check for.

      Returns { available: MultiZetaStimulus[]; missing: MultiZetaStimulus[] }

      An object with two arrays: available and missing.

      const items: MultiZetaStimulus[] = [
      {
      stimulus: 'Item 1',
      zetas: [
      { cats: ['Model A', 'Model B'], zeta: { a: 1, b: 0.5, c: 0.2, d: 0.8 } },
      { cats: ['Model C'], zeta: { a: 2, b: 0.7, c: 0.3, d: 0.9 } },
      ],
      },
      {
      stimulus: 'Item 2',
      zetas: [
      { cats: ['Model B', 'Model C'], zeta: { a: 2.5, b: 0.8, c: 0.35, d: 0.95 } },
      ],
      },
      ];

      const result = filterItemsByCatParameterAvailability(items, 'Model A');
      console.log(result.available);
      // Output: [
      // {
      // stimulus: 'Item 1',
      // zetas: [
      // { cats: ['Model A', 'Model B'], zeta: { a: 1, b: 0.5, c: 0.2, d: 0.8 } },
      // { cats: ['Model C'], zeta: { a: 2, b: 0.7, c: 0.3, d: 0.9 } },
      // ],
      // },
      // ]
      console.log(result.missing);
      // Output: [
      // {
      // stimulus: 'Item 2',
      // zetas: [
      // { cats: ['Model B', 'Model C'], zeta: { a: 2.5, b: 0.8, c: 0.35, d: 0.95 } },
      // ],
      // },
      // ]