Exemplo n.º 1
0
 $c = 2 * ($Z - $meanQ + 2) / ($s * $s);
 $nu = 2 * ($Z - $meanQ + 2) * ($Z - $meanQ + 2) / ($s * $s);
 echo "<BR>";
 echo "<BR>\n";
 echo "<font color='#FF0000'>These charge-state fraction distribution equations are untrustworthy for Z<20. Lighter elements will probably be missing from the plots!</font><BR>\n";
 echo "<BR>\n";
 echo "<BR>Calculated charge-state fractions for the species of interest, \n";
 printf("%d%s:<BR>", $A, $Element[$Z]);
 echo "Here 1.0 is equal to 100% and 0.1 would correspond to 10% of beam incident on the stripping foil exiting in that charge state.<BR>\n";
 echo "<div class=\"t2\"><b>Charge State</b></div>\n";
 echo "<div class=\"t3\"><b>A/q</b></div>\n";
 echo "<div class=\"t4\"><b>Fraction</b></div>";
 echo "<BR><BR><BR>\n";
 for ($i = 1; $i <= $Z + 2; $i++) {
     $t = $c * ($Z - $i + 2);
     $F = frac($nu, $t, $c);
     if ($F > 0.001) {
         echo "<div class=\"t2\">";
         echo $i;
         echo "</div><div class=\"t3\">";
         printf("%5.3f", ($beammass - $i * $emass) / $i);
         echo "</div><div class=\"t4\">";
         printf("%5.3f", $F);
         echo "</div><BR>";
     }
 }
 echo "<BR>\n";
 echo "<BR>\n";
 $imagenum = 1;
 //DRAW BORDER AROUND GRAPH
 $leftx = $plotmarginleft;
Exemplo n.º 2
0
function landscape()
{
    global $picType, $steep, $sealevel, $pic, $pic0, $buf2;
    global $LEVEL_UNDEFINED, $LEVEL_WATER, $NUM_TERRAIN_TYPE;
    global $Z1, $Z2, $Z3, $Z4;
    global $XA, $XB, $YA, $YB;
    global $XADD, $YADD;
    $steep = my_rand() / 2 + 0.75;
    $sealevel = round(($NUM_TERRAIN_TYPE * 3 / 2 + 2) * my_rand() - ($NUM_TERRAIN_TYPE / 2 + 1));
    $Z1 = round(($NUM_TERRAIN_TYPE - 1) * my_rand() - $NUM_TERRAIN_TYPE / 2);
    $Z2 = round(($NUM_TERRAIN_TYPE - 1) * my_rand() - $NUM_TERRAIN_TYPE / 2);
    $Z3 = round(($NUM_TERRAIN_TYPE - 1) * my_rand() - $NUM_TERRAIN_TYPE / 2);
    $Z4 = round(($NUM_TERRAIN_TYPE - 1) * my_rand() - $NUM_TERRAIN_TYPE / 2);
    frac($XA, $YA, $XB, $YB, $Z1, $Z2, $Z3, $Z4);
    ksort($pic);
    $min_height = min($pic);
    $max_height = max($pic);
    $height_diff = abs($max_height - $min_height);
    $mod = 0 - $min_height;
    $new_min = $min_height + ($height_diff - $max_height);
    $new_max = $max_height + ($height_diff - $max_height);
    $new_diff = abs($new_max - $newmin);
    $num_els = count($pic);
    foreach ($pic as $key => $value) {
        $pic[$key] = (int) (($pic[$key] - $min_height) * ($NUM_TERRAIN_TYPE - 1) / $height_diff) + 1;
    }
    $min_height = min($pic);
    $max_height = max($pic);
    $height_diff = abs($max_height - $min_height);
    for ($i = 0; $i < $XB; $i++) {
        for ($j = 0; $j < $YB; $j++) {
            $pic0 = $LEVEL_UNDEFINED;
            $loc = $j * $YB + $i;
            if ($picType[$j * $YB + $i] == "l") {
                $pic0 = abs($pic[$j * $YB + $i] - $sealevel);
            }
            if ($picType[$j * $YB + $i] == "s") {
                $pic0 = $LEVEL_WATER;
            }
            $buf2 .= ZColor($pic0);
        }
    }
    return $buf2;
}