Home Reference Source
public class | source

JND

You can directly use an instance of this class. jnd_exp

Constructor Summary

Public Constructor
public

constructor(Parameters: assoc array)

Initializes a JND experiment object.

Member Summary

Public Members
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

Method Summary

Public Methods
public

calculate_adjusted_value(constants: *): *

Calculates the adjusted value depending on whether this is the first trial of the sub condition or not.

public

check_response(data: JsPsych.data): boolean

Given a JND trial data, determines whether response is correct or not.

public

Determines whether the current sub condition can end or not.

public

When called, will save aggregated trial data into a CSV.

public

When called, will save individual trial data into a CSV.

public

generate_adjusted_distribution(constants: *, adjusted_value: *): object

Generates the adjusted distribution depending on the type of task.

public

generate_trial(type: *): *

Generates a JND trial object for use in the JsPsych timeline.

public

get_next_adjusted_correlation(last_JND_trial: object): double

Calculates the next adjusted correlation (the traditional way).

public

get_next_adjusted_statistic(last_JND_trial: object): double

Calculates the next adjusted value.

public

handle_data_saving(trial: *)

Handles saving the relevant data on a given trial.

public

Initializes the adjusted value for the first time.

public

Determines whether current subcondition has converged or not.

public

Checks whether we have just started a subcondition.

public

prepare_experiment(balancing_type: *)

Orders the input data according to balancing type and initializes the JND object's variables.

public

prepare_practice(dataset: *)

Orders the input dataset by randomizing it, and initializes the practice variables.

Public Constructors

public constructor(Parameters: assoc array) source

Initializes a JND experiment object.

Params:

NameTypeAttributeDescription
Parameters assoc array

passed from routing.

Public Members

public CONVERGENCE_THRESHOLD: number source

public INCORRECT_MULTIPLIER: number source

public MAX_CORRELATION: number source

public MAX_TRIALS: number source

public MIN_CORRELATION: number source

public MIN_TRIALS: number source

public PIXELS_PER_CM: * source

public WINDOW_INTERVAL: number source

public WINDOW_SIZE: number source

public adjusted_quantity_matrix: {} source

public balancing_type: * source

public condition_group: * source

public condition_name: * source

public current_practice_condition_index: number source

public current_sub_condition_index: number source

public distractor_coordinates: string source

public first_trial_of_sub_condition: boolean source

public graph_type: * source

public left_coordinates: string source

public practice_conditions_constants: * source

public raw_constants: * source

public right_coordinates: string source

public sub_condition_order: * source

public sub_conditions_constants: * source

public subject_id: * source

public subject_initials: * source

public trial_data: string source

public trial_structure: * source

Public Methods

public calculate_adjusted_value(constants: *): * source

Calculates the adjusted value depending on whether this is the first trial of the sub condition or not.

Params:

NameTypeAttributeDescription
constants *

{assoc array}

Return:

*

adjusted_value {double}

public check_response(data: JsPsych.data): boolean source

Given a JND trial data, determines whether response is correct or not.

Params:

NameTypeAttributeDescription
data JsPsych.data

@param. {object} constants

Return:

boolean

public end_sub_condition(): boolean source

Determines whether the current sub condition can end or not.

Return:

boolean

True if sub condition should end.

public export_summary_data() source

When called, will save aggregated trial data into a CSV.

public export_trial_data() source

When called, will save individual trial data into a CSV.

public generate_adjusted_distribution(constants: *, adjusted_value: *): object source

Generates the adjusted distribution depending on the type of task. If no task is specified, defaults to using correlation.

Params:

NameTypeAttributeDescription
constants *
adjusted_value *

Return:

object

Adjusted coordinates

public generate_trial(type: *): * source

Generates a JND trial object for use in the JsPsych timeline.

Params:

NameTypeAttributeDescription
type *

{string} "test" or "practice"

Return:

*

trial {object}

public get_next_adjusted_correlation(last_JND_trial: object): double source

Calculates the next adjusted correlation (the traditional way).

Params:

NameTypeAttributeDescription
last_JND_trial object

. {object} constants

Return:

double

next_adjusted_statistic

public get_next_adjusted_statistic(last_JND_trial: object): double source

Calculates the next adjusted value.

Params:

NameTypeAttributeDescription
last_JND_trial object

. {object} constants

Return:

double

next_adjusted_statistic

public handle_data_saving(trial: *) source

Handles saving the relevant data on a given trial.

For reference, these are the helper variables created to assist in trial logic (i.e not present in excel) trial_variables =
{type: 'jnd', run_type: '', left_correlation: '', right_correlation: '', };

These are variables created WITHIN the trial logic that were not present in excel (but need to be outputted to results).
export_variables = {sub_condition: '', // Chronological ordering of sub_condition [1, 2, 3 ... ] balanced_sub_condition: '', // Index of sub_condition according to balancing order jnd: '', base_correlation: '', adjusted_value: '', correct: '', };

Params:

NameTypeAttributeDescription
trial *

{object} block_type {string} "test" or "practice" constants {assoc array} index {integer} adjusted_value {double}

public initialize_adjusted_statistic(constants: object): double source

Initializes the adjusted value for the first time.

Params:

NameTypeAttributeDescription
constants object

Return:

double

adjusted_value

public is_converged_in_window(): boolean source

Determines whether current subcondition has converged or not.

Return:

boolean

True if converged.

public is_start_of_subcondition(): boolean source

Checks whether we have just started a subcondition.

Return:

boolean

True if sub condition has just started.

public prepare_experiment(balancing_type: *) source

Orders the input data according to balancing type and initializes the JND object's variables.

Params:

NameTypeAttributeDescription
balancing_type *

{string} Type of balancing. Currently only latin_square is supported. dataset {[{assoc array}, {assoc array}, ... ]} The data to be ordered.

public prepare_practice(dataset: *) source

Orders the input dataset by randomizing it, and initializes the practice variables.

Params:

NameTypeAttributeDescription
dataset *

{[{assoc array}, {assoc array}, ... ]} The data to be ordered.