Changeset 605


Ignore:
Timestamp:
08/30/16 17:39:10 (8 years ago)
Author:
Maciej Komosinski
Message:
  • Added 'fixedZaxis' option to paramtab (so that it is accessible from scripts)
  • Variable renames, improvements in comments
Location:
cpp/frams
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/simil_test.cpp

    r601 r605  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1717/** Computes a matrix of distances between all genotypes in the specified
    1818    .gen file, using the matching and measure weights as specified in the
    19     command line.
    20 
    21     Command line parameters: [-names] <genotypesFile> <w_dP> <w_dDEG> <w_dNEU> <w_dGEO>
    22 
    23     Parameters:
    24       <genotypesFile> name of a file with genotypes
    25       <w_dP> weight of the difference in the number of parts
    26       <w_dDEG> weight of the difference in degrees of matched parts
    27       <w_dNEU> weight of the difference in neurons of matched parts
    28       <w_dGEO> weight of the distance between matched parts
    29 
    30     Switches:
    31       -names specifies that the number and names of genotypes are to be printed to output
    32         before the distance matrix; by default the number and names are not printed
    33 
    34     Outputs a distance matrix in the format:
    35     <row_1> (columns in a row are separated by TABs)
    36     ...
    37     <row_n>
    38  */
     19    command line. */
    3920int main(int argc, char *argv[])
    4021{
     
    4930    if (argc < 7)
    5031    {
    51         // too few parameters
    5232        printf("Too few parameters!\n");
    53         printf("Command line: [-names] <genotypesFile> <w_dP> <w_dDEG> <w_dNEU> <w_dGEO> <isZfixed>\n\n");
     33        printf("Command line: [-names] <genotypesFile> <w_dP> <w_dDEG> <w_dNEU> <w_dGEO> <fixZaxis?>\n\n");
    5434        printf("Parameters:\n");
    55         printf(" <genotypesFile> name of a file with genotypes\n");
    56         printf(" <w_dP> weight of the difference in the number of parts\n");
    57         printf(" <w_dDEG> weight of the difference in degrees of matched parts\n");
    58         printf(" <w_dNEU> weight of the difference in neurons of matched parts\n");
    59         printf(" <w_dGEO> weight of the distance of matched parts\n\n");
    60         printf(" <isZFixed> should z cooridante be fixed during the alignment\n");
     35        printf("  <genotypesFile> name of a file with genotypes\n");
     36        printf("  <w_dP> weight of the difference in the number of parts\n");
     37        printf("  <w_dDEG> weight of the difference in degrees of matched parts\n");
     38        printf("  <w_dNEU> weight of the difference in neurons of matched parts\n");
     39        printf("  <w_dGEO> weight of the distance of matched parts\n");
     40        printf("  <fixZaxis?> should the 'z' (vertical) coordinate be fixed during the alignment? (0 or 1)\n\n");
    6141        printf("Switches:\n");
    62         printf(" -names specifies that the number and names of genotypes are to be printed to output\n");
    63         printf("   before the distance matrix; by default the number and names are not printed\n\n");
     42        printf("  -names specifies that the number and names of genotypes are to be printed to output\n");
     43        printf("  before the distance matrix; by default the number and names are not printed\n\n");
    6444
    6545        printf("Outputs a symmetric distance matrix in the format:\n");
    66         printf(" <row_1> (columns in a row are separated by TABs)\n");
    67         printf(" ...\n");
    68         printf(" <row_n>\n");
     46        printf("  <row_1> (columns in a row are separated by TABs)\n");
     47        printf("  ...\n");
     48        printf("  <row_n>\n");
    6949
    7050        return -1;
     
    130110        return -1;
    131111    }
    132     else if (M.zFixed != 0 && M.zFixed !=1)
    133     {
    134         printf("<isZFixed>=%d. <isZFixed> should be equal to 0 or 1\n", M.zFixed);
    135         return -1;
     112    else if (M.zFixed != 0 && M.zFixed != 1)
     113    {
     114        printf("<isZFixed>=%d. <isZFixed> should be equal to 0 or 1\n", M.zFixed);
     115        return -1;
    136116    }
    137117   
     
    194174    if (bPrintNames)
    195175    {
    196         // if "-names" switch was given,
    197         // print the number of genotypes and their names
     176        // if "-names" switch was given, print the number of genotypes and their names
    198177        printf("%li\n", pvGenos.size());
    199178                for (unsigned int iGen = 0; iGen < pvNames.size(); iGen++)
  • cpp/frams/model/similarity/simil_model.cpp

    r601 r605  
    3434
    3535static ParamEntry MSparam_tab[] = {
    36     {"Creature: Similarity", 1, 5, "ModelSimilarity", "Evaluates morphological dissimilarity. More information:\nhttp://www.framsticks.com/node/795\nhttp://www.framsticks.com/node/890", },
     36    {"Creature: Similarity", 1, 6, "ModelSimilarity", "Evaluates morphological dissimilarity. More information:\nhttp://www.framsticks.com/node/795\nhttp://www.framsticks.com/node/890", },
    3737    {"simil_parts", 0, 0, "Weight of parts count", "f 0 100 0", FIELD(m_adFactors[0]), "Differing number of parts is also handled by the 'part degree' similarity component.",},
    3838    {"simil_partdeg", 0, 0, "Weight of parts' degree", "f 0 100 1", FIELD(m_adFactors[1]), "",},
    3939    {"simil_neuro", 0, 0, "Weight of neurons count", "f 0 100 0.1", FIELD(m_adFactors[2]), "",},
    4040    {"simil_partgeom", 0, 0, "Weight of parts' geometric distances", "f 0 100 0", FIELD(m_adFactors[3]), "",},
    41     {"evaluateDistance", 0, PARAM_DONTSAVE | PARAM_USERHIDDEN, "evaluate model dissimilarity", "p f(oGeno,oGeno)", PROCEDURE(p_evaldistance), "Calculates dissimilarity between two models created from Geno objects.",},
     41        {"simil_fixedZaxis", 0, 0, "Fix 'z' (vertical) axis?", "d 0 1 0", FIELD(fixedZaxis), "", },
     42        {"evaluateDistance", 0, PARAM_DONTSAVE | PARAM_USERHIDDEN, "evaluate model dissimilarity", "p f(oGeno,oGeno)", PROCEDURE(p_evaldistance), "Calculates dissimilarity between two models created from Geno objects.", },
    4243    {0,},
    4344};
     
    19971998            // get the position of the Part
    19981999            P1Pos = P1->p;
    1999             if (zFixed == 1)
     2000                        if (fixedZaxis == 1)
    20002001            {
    2001                 P1Pos.z = 0;    
     2002                P1Pos.z = 0; //fixed vertical axis, so pretend all points are on the xy plane
    20022003            }
    20032004            for (iP2 = 0; iP2 < pModel->getPartCount(); iP2++)
     
    20072008                // get the position of the Part
    20082009                P2Pos = P2->p;
    2009                 if (zFixed == 1)
     2010                                if (fixedZaxis == 1)
    20102011                {
    2011                         P2Pos.z = 0;    
     2012                        P2Pos.z = 0; //fixed vertical axis, so pretend all points are on the xy plane
    20122013                }
    20132014                // compute the geometric (Euclidean) distance between the Parts
     
    20192020
    20202021        MatrixTools::SVD(vEigenvalues, nSize, pDistances, m_aPositions[ iMod ]);
    2021         if (zFixed == 1)
     2022                if (fixedZaxis == 1) //restore the original vertical coordinate of each Part
    20222023        {
    2023                 for (int coord = 0; coord < pModel->getPartCount(); coord++)
     2024                for (int part = 0; part < pModel->getPartCount(); part++)
    20242025                {
    2025                         m_aPositions[ iMod ][coord].z = pModel->getPart(coord)->p.z;
     2026                        m_aPositions[iMod][part].z = pModel->getPart(part)->p.z;
    20262027                }
    20272028        }
  • cpp/frams/model/similarity/simil_model.h

    r601 r605  
    8282    double m_adFactors[4];
    8383
    84     //Controls the depth of fuzzy neighbourhood
     84        //for Zfixed = 1, the "z" (vertical) coordinates are not taken into account during PCA alignment
     85        int fixedZaxis;
     86       
     87        //Controls the depth of fuzzy neighbourhood
    8588    int fuzzyDepth;
    8689    int isFuzzy;
    87     //for Zfixed = 1 z coordinates are not taken into account during PCA alignment
    88     int zFixed;
    8990
    9091    /// Interface to local parameters
Note: See TracChangeset for help on using the changeset viewer.