menu_book

Knowledge Base

Documentation, guides, and resources for Noldus products.

EthoVision XT 19 - Dependent Variables Reference (Continued)

Last updated: Jul 29, 2026

GetSignal

Returns the value of a hardware signal.

  • Syntax
    GetSignal(Device name, Signal name)
  • Arguments
    • Device name: the name of the device specified in EthoVision XT. For example, "Device B". To know the device name, in the Arena Settings click the Arena-Hardware Mapping button, under Device name click the cell of the device you require and press Ctrl+C. Paste the text into the JavaScript code as Device name.
    • Signal name: the name of the signal that you want to acquire. For example, "Number of licks". To know the signal name, open an Analysis profile, click the button next to Hardware continuous, select a Device type, Device, and Signal. Take note of the text near Signal, and enter this text in the JS code as Signal name.
  • Example

    In the following example, JavaScript reads the value of the signal "Number of licks" of a lickometer (Device B) and outputs it for each sample of the track.

    function Process()
    {
        var s = GetSignal("Device B", "Number of licks");
        SetOutput(s);
    }

New Point

With the new Point statement you can define a point in space.

  • Syntax
    new Point(x,y,z)
  • Arguments
    • x, y, z (z is optional): The coordinates in mm based on the calibration axes and origin in the Arena Settings.
  • Example
    pt1 = new Point(200, 300);
  • Note: You cannot visualize the position of points defined with JavaScript. To do so, define points in the Arena Settings.

GetPointPoi

With this command you can extract the coordinates of a point of interest of the center of a zone or arena. Note that GetPointPoi returns the position of the point, then you have to extract the coordinates with additional commands (e.g. x = pt.x).

  • Syntax
    GetPointPoi(point)
  • Arguments
    • point: The name of the point or the zone or arena, of which you want to find the center.
  • Example
    const g_zone = "Zone 1";
    function Start()
    {
    }
    function Stop()
    {
    }
    function Process()
    {
        var pt = GetPointPoi(g_zone);
        var xc = pt.x;
        var xy = pt.y;
    }

IsInZone

This function has been replaced by other functions in EthoVision XT 19 (see below).

  • For single-subject tracking: see IsPointInZone
  • For multi-subject tracking: see IsSubjectCenterInZone, IsSubjectNoseInZone, IsSubjectTailInZone

You can still use IsInZone in your code, but it won't work properly when analyzing data points in hidden zones.

IsSubjectTailInZone

Use this function to determine if a body point of a subject is within a zone. The zone must be defined in the Arena Settings. The return value is boolean (true or false).

  • Syntax
    IsSubjectCenterInZone(Subject name, Zone name);
    IsSubjectNoseInZone(Subject name, Zone name);
    IsSubjectTailInZone(Subject name, Zone name);
  • Arguments
    • Subject name: the name of one of the subjects listed in the Experiment Settings.
    • Zone name: the name of the zone of interest defined in the Arena Settings; for example, "Zone 1". You can specify the name directly ("Zone 1" with quotes), or a variable that contains that name. The zone can be a single zone, a cumulative zone, an entry zone, or a hidden zone.
  • Example – One Subject
    var bC = IsSubjectCenterInZone("Subject 1", "Zone 1");
    var bN = IsSubjectNoseInZone("Subject 1", "Zone 1");
    var bT = IsSubjectTailInZone("Subject 1", "Zone 1");

    or

    const g_sZone = "Zone 1"
    var bC = IsSubjectCenterInZone("Subject 1", g_sZone);
    var bN = IsSubjectNoseInZone("Subject 1", g_sZone);
    var bT = IsSubjectTailInZone("Subject 1", g_sZone);
  • Example – Multiple Subjects
    var bC1 = IsSubjectCenterInZone("Subject 1", "Zone 1");
    var bC2 = IsSubjectCenterInZone("Subject 2", "Zone 1");

IsPointInZone

Use this function to determine if a point (a body point, or a point of interest) is within a zone. The zone must be defined in the Arena Settings. The return value is boolean (true or false).

  • Syntax
    IsPointInZone(Zone name, Point name)
  • Arguments
    • Zone name: the name of a zone defined in the Arena Settings; for example, "Zone 1".
    • Point name: The name of a body point or a point of interest defined in the Arena Settings.
  • Example
    pt = GetCenter();
    var b1 = IsPointInZone("Zone 1", pt);

    or

    pt = new Point(10, 10);
    var b1 = IsPointInZone("Zone 1", pt);

Point.Equals

Checks if two points are equal.

  • Syntax
    point1.Equals(point2)
  • Arguments
    • point1: the first point
    • point2: the second point
  • Example

    The variable b gets the value 1 if the two points pt1 (the center of the subject) and pt2 (a point in space defined with the new statement) have the same coordinates.

    var pt1 = GetCenter();
    var pt2 = new Point(1.0, 2.0);
    var b = pt1.Equals(pt2);
  • Errors: If one of the two points is null, the value is not calculated and an invalid reference is returned.

IsSubjectActor

Determines if the subject specified (argument) is currently the actor (focal subject) of the track being analyzed. The return value is boolean (true or false). You can use this function to skip comparisons and calculations that do not make sense.

  • Syntax
    IsSubjectActor(Subject name)

    Where Subject name is the name of one of the subjects listed in the Experiment Settings.

  • Example

    In this example a for loop scans the list of i subjects Subject 1, Subject 2, etc. contained in the array g_aSubjects[i] and calculates the distance between the focal subject (that is, the subject of the currently analyzed track) and the subject i.

    for (i = 0; i < g_aSubjects.length; ++i)
    {
        var ptSubj = GetSubjectCenter(g_aSubjects[i]);
        (...)
        //invoke Distance function
        var Dist = Distance(ptFocal, ptSubj);
    }

    Obviously at some point in this loop the focal subject and the subject i are the same individual. You can exclude the distance calculation focal-to-focal by inserting an extra check.

    var b = IsSubjectActor(g_aSubject[i]);
    if (b == true)
    {
        //invoke distance function
    }

Distance

To calculate the distance between two points, see Point.Distance. You can also use the code below and invoke the function in your script. Distance is expressed in internal units (mm), independent of the units selected in the Experiment Settings.

  • Function
    // Function to calculate distance between two points
    function Distance(pt1, pt2)
    {
        var dx = pt1.x - pt2.x;
        var dy = pt1.y - pt2.y;
        return Math.sqrt(dx * dx + dy * dy);
    }
  • Example of Function Call
    //Get the center point of subject 1 and subject 2
    var cSubj1 = GetSubjectCenter("Subject 1");
    var cSubj2 = GetSubjectCenter("Subject 2");
    //call distance function
    var Dist = Distance(cSubj1, cSubj2);
  • Errors: If one of the two points is null, the value is not calculated.

Point.Distance

Calculates the distance between two points. Distance is expressed in internal units (mm), independent of the units selected in the Experiment Settings.

  • Syntax
    point1.Distance(point2)
  • Arguments
    • point1: the first point
    • point2: the second point
  • Example
    var pt1 = GetCenter();
    var pt2 = GetNose();
    var dist = pt1.Distance(pt2);
  • Errors: If one of the two points is null, the value is not calculated and an invalid reference is returned.

Source: EthoVision XT 19 Help, Noldus Information Technology

Compare solutions

Not sure which Noldus product fits your protocol? We can help you make the right choice.

Noldus is here to assist you throughout the whole process.

shopping_bag
check_circle

Thank you!

We'll get back to you shortly.

error

Please correct the following errors:

error

error

error

error

By clicking Submit, you consent to Noldus processing your data as described in our privacy policy.