Changeset 493 for experiments


Ignore:
Timestamp:
04/10/16 17:48:18 (9 years ago)
Author:
oriona
Message:

Microns to frams scaling rate changed. New world size, new log files added.

Location:
experiments/frams/foraminifera/data/scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • experiments/frams/foraminifera/data/scripts/foraminifera.expdef

    r488 r493  
    2525global chambers;
    2626global colors;
    27 global dir_change;
     27global retColors;
     28global curColor;
     29global dir_change_sec;
    2830global max_chamber_volume;
    2931global movePerStep;
     
    3335global changePeriod;
    3436global phase;
     37global nutrientSqrCm;
    3538global species_genes;
    3639
     
    8083        //world
    8184        SignalView.mode = 1;
    82         World.wrldwat = 200;
    83         World.wrldsiz = micronsToFrams(40000);
     85        World.wrldwat = 500;
     86        World.wrldsiz = micronsToFrams(100000);
    8487        World.wrldbnd = 1;
    8588        ExpProperties.stress = 1;
     
    9598
    9699        //ExpProperties.logging = 1; //uncomment to enable logging simulation parameters to log files   
     100        ExpProperties.logPref = "";
    97101
    98102        //reproduction
     
    101105        ExpProperties.mutationprob = 0;
    102106        ExpProperties.repro_time = 720;
    103         ExpProperties.gametoPeriod = 43200;
     107        ExpProperties.gametoPeriod = 21600;
    104108        ExpProperties.divisionCost = 15.6;
    105109        reprocounter = 0;
     
    109113        init_chambers();
    110114
     115        curColor = retColors[0];
    111116        //morphology
    112         dir_change = 30000;
     117        dir_change_sec = 30000;
    113118        ExpProperties.zone1_range = micronsToFrams(1000);
    114119        ExpProperties.zone2_range = micronsToFrams(3000);
     
    137142        ExpProperties.energy_move = 0.0000005;
    138143
    139         ExpProperties.energies0_haplo = energyFromVolume(micronsToFrams(20),1);
    140         ExpProperties.energies0_diplo = energyFromVolume(micronsToFrams(1.25),1);
     144        ExpProperties.energies0_haplo = 20;
     145        ExpProperties.energies0_diplo = 1.25;
    141146        ExpProperties.feedtrans = 0.001;
    142147        ExpProperties.e_repro_cost_haplo = 0.3;
     
    149154        changePeriod = 0;
    150155        phase = "low";
    151         ExpProperties.foodperiod = 3600;
    152         ExpProperties.foodPeriodChange = 0;
     156        nutrientSqrCm = 10;
     157        ExpProperties.foodperiod = 25920;
     158        ExpProperties.foodPeriodChange = 6;
    153159        ExpProperties.nutrientradius = micronsToFrams(10);
    154160        ExpProperties.energy_nut = energyFromVolume(ExpProperties.nutrientradius,1);
    155         ExpProperties.feedrate = 1;
     161        ExpProperties.nutrient_pop = Math.pow(framsToMicrons(World.wrldsiz)*0.0001,2)/nutrientSqrCm;
    156162        ExpProperties.ingestion = 0.25;
    157163        nutrientenergywaiting = 0;
     
    159165        ExpState.nutrient = "";
    160166       
    161         addSpecies({"min_repro_energies" : [4,6]});
    162         addSpecies({"min_repro_energies" : [4,8]});
     167        //addSpecies({"min_repro_energies" : [4,6]});
     168        //addSpecies({"min_repro_energies" : [4,8]});
    163169}
    164170
     
    189195function micronsToFrams(micrometers)
    190196{
    191         return micrometers*0.025;
     197        return micrometers*0.01;
    192198}
    193199
    194200function framsToMicrons(framsworldunits)
    195201{
    196         return framsworldunits/0.025;
     202        return framsworldunits/0.01;
    197203}
    198204
     
    215221{
    216222        var geno = createForamMorphology(species_genes[species]->morphotype, ploid, chambernum);
     223        curColor = retColors[ploid];
    217224        var cr = Populations[0].add(geno);
    218225        cr.name = "Initial creature" + species + "_" + iter;
     
    235242                ploid = 1;
    236243        }       
    237         //add new foram with random energy bewtween starting energy and reproduction treshold
     244        //add new foram with random energy bewtween starting energy and reproduction threshold
    238245        addForam(species, iter, int(Math.rndUni(0,species_genes[species]->min_repro_energies[ploid])),ploid);
    239246}
     
    242249function addSpecies(new_genes)
    243250{
    244         species_genes.add({"min_repro_energies" : [4,6], "energies0" : [20, 1.25], "hibernation" : 0, "morphotype" : 0});
     251        species_genes.add({"min_repro_energies" : [ExpProperties.min_repro_energ_haplo,ExpProperties.min_repro_energ_diplo], "energies0" : [ExpProperties.energies0_haplo, ExpProperties.energies0_diplo], "hibernation" : 0, "morphotype" : 0});
    245252        for (var i = 0; i < new_genes.size; i++)
    246253        {
     
    358365        if (ExpProperties.visualize == 1)
    359366        {
    360                 var ret = Populations[2].add("//0\np:sh=3,sx=0.01,sy="+getZoneRange(cr,1)+",sz="+getZoneRange(cr,1)+",ry=1.57,vr=1.0,1.0,1.0");
     367                var ret = Populations[2].add("//0\np:sh=3,sx=0.01,sy="+getZoneRange(cr,1)+",sz="+getZoneRange(cr,1)+",ry=1.57,vr="+curColor);
    361368                cr.data->reticulopodiacreature = ret;
    362369        }
     
    395402        if ((chamber_num+1) < chambers[cr.data->lifeparams->species].size)
    396403        {
     404                curColor = retColors[cr.data->lifeparams->gen];
    397405                var geno = createForamMorphology(getGene(cr, "morphotype", 0), cr.data->lifeparams->gen, chamber_num+1);
    398406                var cr2 = Populations[0].add(geno);
     
    476484}
    477485
    478 function fence(pos)
    479 {
    480         return Math.min(Math.max(0,pos),World.wrldsiz);
     486function fence(pos, zone)
     487{
     488        return Math.min(Math.max(0+zone,pos),World.wrldsiz-zone);
    481489}
    482490
     
    486494
    487495        //adjustment in z axis
    488         cr.moveAbs(fence(cr.pos_x), fence(cr.pos_y), 0);
     496        cr.moveAbs(fence(cr.pos_x, getZoneRange(cr, 1)), fence(cr.pos_y,getZoneRange(cr, 1)), 0);
    489497
    490498        //are there any nutrients in zone 1 or 2?
     
    504512        }
    505513        //random move
    506         else if (Simulator.stepNumber%int(dir_change/ExpProperties.secPerStep) == 0)
     514        else if (Simulator.stepNumber%int(dir_change_sec/ExpProperties.secPerStep) == 0)
    507515        {
    508516                cr.data->lifeparams->dir = randomDir();
     
    552560}
    553561
     562function createLogVector(cr, value)
     563{
     564        var vec = Vector.new();
     565        for (var i = 0; i < species_genes.size; i++)
     566        {
     567                for (var j = 0; j < 2; j++)
     568                {
     569                        vec.add(0);
     570                }
     571                if (cr.data->lifeparams->species == i)
     572                {
     573                        vec[i*2+cr.data->lifeparams->gen] = value;             
     574                }
     575        }
     576        return vec;
     577}
    554578
    555579function onForamsStep(cr)
     
    592616                if (visualization(cr))
    593617                {
    594                         cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1)-getProperty(cr.data->lifeparams->gen, "chamber_proculus"));
     618                        cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1));
    595619                }
    596620
    597621                if (deathConditions(cr) == 1)
    598622                {
     623                        if (ExpProperties.logging == 1)
     624                        {
     625                                log(createLogVector(cr, cr.data->lifeparams->max_energy_level),ExpProperties.logPref+"fossil_log.txt");
     626                        }                       
    599627                        Populations[0].kill(cr);
    600628                        return;
     
    712740        if (nutrientenergywaiting*ExpProperties.secPerStep >= ExpProperties.foodperiod)
    713741        {
    714                 for (var i = 0; i < ExpProperties.feedrate; i++)
     742                for (var i = 0; i < ExpProperties.nutrient_pop; i++)
    715743                {   
    716744                        addNutrient();
     
    719747                nutrientenergywaiting = 0.0;
    720748                Simulator.checkpoint();
    721         }
     749
     750                if (ExpProperties.logging == 1)
     751                {
     752                        log([ExpProperties.nutrient_pop],ExpProperties.logPref+"nutrients_log.txt");
     753                }
     754        }
     755
    722756}
    723757
     
    808842        log_energies.add(e_nut);
    809843
    810         log(log_numbers, "forams_log.txt");
    811     log(log_energies,  "energies_log.txt");
     844        log(log_numbers, ExpProperties.logPref+"forams_log.txt");
     845    log(log_energies,  ExpProperties.logPref+"energies_log.txt");
    812846}
    813847
     
    841875name:Stop after the given number of simulation steps
    842876type:d 0 1000000 0
     877
     878property:
     879id:logPref
     880name:Log prefix
     881type:s
    843882
    844883property:
     
    10441083
    10451084property:
    1046 id:feedrate
     1085id:nutrient_pop
    10471086name:Feeding rate
    10481087type:f 0 1000000
     
    10651104id:energy_nut
    10661105name:Nutrient energy
    1067 type:f 0 100000
     1106type:f 0 10000000
    10681107group:Energy
    10691108
     
    10831122id:nutrientradius
    10841123name:Nutrient size
    1085 type:f 0.1 0.9 0.1
     1124type:f 0.001 0.9 0.1
    10861125group:Energy
    10871126
  • experiments/frams/foraminifera/data/scripts/foraminifera.inc

    r488 r493  
    55{
    66        colors = ["1.0,1.0,0.0","1.0,0.5,0.0"];
     7        retColors = ["1.0,1.0,1.0", "1.0,0.0,0.0"];
    78        chambers = [ ["0.0,0.0,0.0,",  //coiled
    89        "1.08020961284637, -0.0597195439040661, -0.0393781512975693,",
     
    108109                new_genes = [parent.data->genes, parent2.data->genes];
    109110                gen = 1 - parent.data->lifeparams->gen;
     111
     112                if (ExpProperties.logging == 1)
     113                {
     114                                log(createLogVector(parent, parent.energy),ExpProperties.logPref+"repro_energies_log.txt");
     115                                log(createLogVector(parent2, parent2.energy),ExpProperties.logPref+"repro_energies_log.txt");
     116                                log(createLogVector(parent, number),ExpProperties.logPref+"repro_num_log.txt");
     117                }       
    110118        }
    111119
     
    122130        var energy0 =getEnergy0( getGene(parent,"energies0", 0)[0]);
    123131        var number = ((1 - (getProperty(parent.data->lifeparams->gen, "e_repro_cost"))) * parent.energy) / energy0;
     132
     133                if (ExpProperties.logging == 1)
     134                {
     135                        log(createLogVector(parent, parent.energy),ExpProperties.logPref+"repro_energies_log.txt");
     136                        log(createLogVector(parent, number),ExpProperties.logPref+"repro_num_log.txt");
     137                }       
    124138
    125139        Simulator.print("diploid number of offspring: " + number+ " energ0: " + energy0);
     
    189203                                                print_repro_info(parent1);
    190204                                                print_repro_info(parent2);
    191                                                 //Simulator.print("parents "+parent1.uid + " " + parent2.uid + " reproduced: "+Simulator.stepNumber);
    192205                                                pop.kill(parent1);
    193206                                                pop.kill(parent2);
    194207                                                parent1 = null;
    195208                                                parent2 = null;
    196                                                
    197209                                        }
    198210                                }       
     
    280292function createOffspring(geno, energy, parent_genes, parent_lifeparams)
    281293{
     294        curColor = retColors[1-parent_lifeparams->gen];
    282295        var cr = Populations[0].add(geno);
    283296        cr.energy0 = energy;
  • experiments/frams/foraminifera/data/scripts/foraminifera.show

    r486 r493  
    2323        GLDisplay.minfps = 10;
    2424        TrackingCam.cam_h = 15; //more side view
    25         Params = { "feedrate" : [200,100,50], "feedtrans" : [0.05,0.125,0.25],"energy_nut" :[0.5,1.5,3.0], "stress" : [0,1], "visualize" : [0,1]};
     25        Params = { "foodperiod" : [43200,25920,10800], "feedtrans" : [0.001,0.001,0.001],"energy_nut" :[144.54,544.54,944.54], "stress" : [0,1], "visualize" : [0,1]};
    2626        ShowProperties.visualize=1;
    2727}
     
    5757}
    5858
    59 function ShowProperties_feedrate_set()
     59function ShowProperties_foodperiod_set()
    6060{
    61         setShowParam("feedrate");
     61        setShowParam("foodperiod");
    6262}
    6363
     
    8585
    8686property:
    87 id:feedrate
    88 name:Feeding rate
     87id:foodperiod
     88name:Feeding period
    8989type:d 0 2 1 ~Low~Medium~High
    9090
Note: See TracChangeset for help on using the changeset viewer.