/** Test of evaluateAt method, of class ParameterisedGroup. */
  @Test
  public void testEvaluateAt() throws ParameterException {
    System.out.println("---  testEvaluateAt...");

    // SegmentLocation loc1 = new PostSynapticTerminalLocation(d2.getSegmentId(), 0.5f);

    assertEquals(0.5, pg1.evaluateAt(cell, d2, 0.5f), 0);
    assertEquals(15, pg2.evaluateAt(cell, d2, 0.5f), 0);

    //////// assertEquals(15, pg5.evaluateAt(cell, loc1), 0);

    // SegmentLocation loc2 = new PostSynapticTerminalLocation(d3.getSegmentId(), 0.5f);

    assertEquals(5d / 6d, pg1.evaluateAt(cell, d3, 0.5f), 1e-7);
    assertEquals(25, pg2.evaluateAt(cell, d3, 0.5f), 0);

    assertEquals(0.5, pg3.evaluateAt(cell, d3, 0.5f), 0);

    assertEquals(0, pg4.evaluateAt(cell, d3, 0), 0);
    assertEquals(5, pg4.evaluateAt(cell, d3, 0.5f), 0);

    SegmentLocation sl1 = new SegmentLocation(d3.getSegmentId(), 0.5f);

    assertEquals(
        25,
        pg5.evaluateAt(cell, cell.getSegmentWithId(sl1.getSegmentId()), sl1.getFractAlong()),
        0);

    assertEquals(30, pg5.evaluateAt(cell, d3, 1), 0);

    GenesisCompartmentalisation g = new GenesisCompartmentalisation();

    Cell gCell = g.getCompartmentalisation(cell);

    System.out.println(CellTopologyHelper.printDetails(cell, null));

    System.out.println(
        "Changed from morph: " + cell.getMorphSummary() + ", to morph: " + gCell.getMorphSummary());

    System.out.println("getSegmentMapper: " + g.getSegmentMapper());

    System.out.println(CellTopologyHelper.printDetails(gCell, null));

    SegmentLocation sl1_g = g.getSegmentMapper().mapSegmentLocation(sl1);

    System.out.println("Mapped: " + sl1 + " to " + sl1_g);

    assertEquals(
        25,
        pg5.evaluateAt(gCell, gCell.getSegmentWithId(sl1_g.getSegmentId()), sl1_g.getFractAlong()),
        0);
  }
  @Before
  public void setUp() {
    System.out.println("---------------   setUp() ParameterisedGroupTest");

    cell = new OneSegment("Simple");

    d1 =
        cell.addDendriticSegment(
            1, "d1", new Point3f(10, 0, 0), cell.getFirstSomaSegment(), 1, "Sec1", false);
    d2 = cell.addDendriticSegment(2, "d2", new Point3f(20, 0, 0), d1, 1, "Sec2", false);
    d3 = cell.addDendriticSegment(7, "d3", new Point3f(20, 10, 0), d2, 1, "Sec3", false);

    d3.getSection().setStartRadius(3);

    d1.getSection().setNumberInternalDivisions(4);
    d2.getSection().setNumberInternalDivisions(3);
    d3.getSection().setNumberInternalDivisions(5);

    d3.getSection().addToGroup(tipSection);

    pg1 =
        new ParameterisedGroup(
            "ZeroToOne",
            Section.DENDRITIC_GROUP,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.MOST_DIST_AT_1,
            "p1");

    pg2 =
        new ParameterisedGroup(
            "StartToEnd",
            Section.DENDRITIC_GROUP,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.NO_TRANSLATION,
            DistalPref.NO_NORMALISATION,
            "p2");

    pg3 =
        new ParameterisedGroup(
            "TipZeroToOne",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.MOST_DIST_AT_1,
            "p3");

    pg4 =
        new ParameterisedGroup(
            "TipToEnd",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.NO_NORMALISATION,
            "p4");

    pg5 =
        new ParameterisedGroup(
            "TipToEnd_PathFromRoot",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.NO_TRANSLATION,
            DistalPref.NO_NORMALISATION,
            "p5");

    /*
    pg5 = new ParameterisedGroup("3DDistZeroToOne",
                               Section.ALL,
                               Metric.THREE_D_RADIAL_POSITION,
                               ProximalPref.MOST_PROX_AT_0,
                               DistalPref.MOST_DIST_AT_1);*/

  }