HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/PBN/PSAproduction3/tvireport.php
 <?php
extract($_REQUEST);
session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TR016 Production Report</title>
<style type="text/css">
<!--
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #ffffff;
	margin: 0; /* 比較好的做法是將 Body 元素的邊界與欄位間隔調整為零,以處理不同的瀏覽器預設值 */
	padding: 0;
	text-align: center; /* 這樣會讓容器在 IE 5* 瀏覽器內置中對齊。然後,文字會在 #container 選取器中設定為靠左對齊預設值 */
	color: #000000;
}
.oneColElsCtr #container {
	width: 46em;
	background: #FFFFFF;
	margin: 0 auto; /* 自動邊界 (搭配寬度) 會讓頁面置中對齊 */
	border: 0px solid #000000;
	text-align: left; /* 這樣做會覆寫 Body 元素上的 text-align: center。 */
}
.oneColElsCtr #mainContent {
	padding: 0 20px; /* 請記住,欄位間隔就是 Div 方塊內部的空間,而邊界就是 Div 方塊外部的空間 */
}
.oneColElsCtr tr td table tr td strong {
	font-size: 24px;
}
-->
</style></head>


<body class="oneColElsCtr">

<br>
<br>


<?php
echo "Job id:".$po." press:".$press." paper:".$paper ." date:" .$date. " file:".$tvifile;
if ($target=="Fogra39") {
	$PTL=95;$PTa=0;$PTb=-2;
	$RPCCl=55;$RPCCa=-37;$RPCCb=-50;
$RPCMl=48;$RPCMa=74;$RPCMb=-3;
$RPCYl=89;$RPCYa=-5;$RPCYb=93;
$RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$RPCC50l=75.62;$RPCC50a=-16.48;$RPCC50b=-26.70;
$RPCM50l=71.23;$RPCM50a=33.64;$RPCM50b=-7.40;
$RPCY50l=91.55;$RPCY50a=-4;$RPCY50b=41.00;
$RPCK50l=61.82;$RPCK50a=0.01;$RPCK50b=-1.16; 

$RPCgl=58.04;$RPCga=0.26;$RPCgb=-1.13; 
}
elseif ($target=="CRPC6") {
	$PTL=95;$PTa=1;$PTb=-4;
$RPCCl=56;$RPCCa=-37;$RPCCb=-50;
$RPCMl=48;$RPCMa=75;$RPCMb=-4;
$RPCYl=89;$RPCYa=-4;$RPCYb=93;
$RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$RPCC50l=75.14;$RPCC50a=-16.63;$RPCC50b=-27.88;
$RPCM50l=70.07;$RPCM50a=35.98;$RPCM50b=-7.49;
$RPCY50l=91.49;$RPCY50a=-2.75;$RPCY50b=41.34;
$RPCK50l=60.4;$RPCK50a=0.46;$RPCK50b=-2.59;

$RPCgl=57.46;$RPCga=0.38;$RPCgb=-2.03;
}
elseif ($target == "GRACoL2006") {
  $PTL=95;$PTa=0;$PTb=-2;
  $RPCCl=55;$RPCCa=-37;$RPCCb=-50;
  $RPCMl=48;$RPCMa=74;$RPCMb=-3;
  $RPCYl=89;$RPCYa=-5;$RPCYb=93;
  $RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$RPCC50l=75;$RPCC50a=-17;$RPCC50b=-28;
$RPCM50l=70;$RPCM50a=35;$RPCM50b=-6;
$RPCY50l=91;$RPCY50a=-4;$RPCY50b=44;
$RPCK50l=60;$RPCK50a=-1;$RPCK50b=-2; 

$RPCgl=57;$RPCga=0.1;$RPCgb=-1; 
}

?><br><br>


<?php 

$connection = mysql_connect("127.0.0.1", "root", "fredsql") or die ("Unable to connect!");
	mysql_query("SET NAMES 'utf8'");
	$db = "tvicheck-st";
		// select database
		mysql_select_db($db) or die ("Unable to select database!");
		
		$queryID="select id from psaProduction2  where filename='$tvifile'";
		$resultID = mysql_query($queryID) or die ("Error in query: $query. " . mysql_error());
		while ($row=mysql_fetch_object($resultID))
		{
		$imgID=($row->id)-1;
		}
		
  
		mysql_close($connection);

$scatterN="./image/".$imgID."-scatter.png";
$CMYSIDN="./image/".$imgID."-CMYSID.png";
$CMYSID_DN="./image/".$imgID."-CMYSID_D.png";
$KSIDN="./image/".$imgID."-KSID.png";
$KSID_DN="./image/".$imgID."-KSID_D.png";
$CMYK50N="./image/".$imgID."-CMYK50.png";
$CMYK50_TN="./image/".$imgID."-CMYK50_T.png";
$grayN="./image/".$imgID."-gray.png";
$gray_DN="./image/".$imgID."-gray_D.png";

 ?>

<?php

function get_betweenC ($text, $s1, $s2) {
$mid_url = "";
$pos_s = strrpos($text,$s1);
$pos_e = strpos($text,$s2);
for ( $i=$pos_s+strlen($s1) ; (( $i<($pos_e)) && $i < strlen($text)) ; $i++ ) {
$mid_url .= $text[$i];
}
return $mid_url;
}

function get_between ($text, $s1, $s2) {
$mid_url = "";
$pos_s = strrpos($text,$s1);
$pos_e = strrpos($text,$s2);
for ( $i=$pos_s+strlen($s1) ; (( $i<($pos_e)) && $i < strlen($text)) ; $i++ ) {
$mid_url .= $text[$i];
}
return $mid_url;
}

include 'sp38XYZ.php';
include 'spXYZ.php';
include 'lab2xyz.php';
include 'SCCA06.php';
include 'xyz2lab01.php';
include 'xyz2lab.php';
include 'dE00.php';
include 'DensityV.php';
include 'DensityV38.php';
$sum=100;
$check=1;
	echo $target." Production Report! (for Type 1 paper, white backing)" .  "<br />";
    
	
   	 
	   echo "Report start: " .  "<br />";
     // echo "Stored in: " . "upload/" . $_FILES["file"]["name"]. "<br />";
	  
	  ///parsing start
	  
	  $contents = file("http://localhost/PSAproduction3/upload/".$tvifile);
		$stringC = implode($contents);
		
		$fMark = strrpos($stringC,'i1Profiler');
		//echo "fMark:".$fMark."<br>";
		$fMarkC = strrpos($stringC,'ColorPort');
		//echo "fMarkC:".$fMarkC."<br>";
		
if ($fMark>0) { /////////////////////////////////////////////////////////////////////////////////////////// i1 profiler  go 572
		 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'BEGIN_DATA_FORMAT');
//echo "cols:".$cols."_zz<br>";
		//echo $contents[20]; 
		//echo $stringC; 
$string = implode($contents);		
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);
//echo $p;



$datastring=get_between($p,"BEGIN_DATA,",",END_DATA");

$dot = explode("\t", $datastring);
//print_r ($dot);
echo "<br>";



$Pdot=0; //paper
//echo "take:".$dot[6+$cols*$Pdot];


$PX=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);

$PY=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);

$PZ=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);


//echo "take PX:".$PX."_Y:".$PY."_Z:".$PZ;

$PL=xyz2lab01("l",$PX,$PY,$PZ);
$Pa=xyz2lab01("a",$PX,$PY,$PZ);
$Pb=xyz2lab01("b",$PX,$PY,$PZ);

//$depaper=sqrt(pow((95-$PL),2)+ pow((1-$Pa),2)+pow(((4)-$Pb),2));
echo $target." paper L: ".$PTL." a: ".$PTa." b: ".$PTb. "<br />"; 

echo "paper measured: L:".$PL.",  a:".$Pa.",  b:".$Pb.  "<br />";
//echo "CRPC 6 Paper: 95	1	-4,<br> Cyan:56	-37	-50".", Magenta:48	75	-4".", Yellow:89	-4	93".", Black:16	0	0".  "<br />";







$Xp=$PX*100;
$Yp=$PY*100;
$Zp=$PZ*100;
//////////////////////////////////////////////////////////////CCCCCCCC
$RPCCX=lab2xyz("x",$RPCCl,$RPCCa,$RPCCb);
$RPCCY=lab2xyz("y",$RPCCl,$RPCCa,$RPCCb);
$RPCCZ=lab2xyz("z",$RPCCl,$RPCCa,$RPCCb);

$scCX=SCCA06("x",$RPCCX,$Xp,$target);
$scCY=SCCA06("y",$RPCCY,$Yp,$target);
$scCZ=SCCA06("z",$RPCCZ,$Zp,$target);

$scCL=xyz2lab("l",$scCX,$scCY,$scCZ);
$scCa=xyz2lab("a",$scCX,$scCY,$scCZ);
$scCb=xyz2lab("b",$scCX,$scCY,$scCZ);

$RPCC50X=lab2xyz("x",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Y=lab2xyz("y",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Z=lab2xyz("z",$RPCC50l,$RPCC50a,$RPCC50b);

$scC50X=SCCA06("x",$RPCC50X,$Xp,$target);
$scC50Y=SCCA06("y",$RPCC50Y,$Yp,$target);
$scC50Z=SCCA06("z",$RPCC50Z,$Zp,$target);

$scC50L=xyz2lab("l",$scC50X,$scC50Y,$scC50Z);
$scC50a=xyz2lab("a",$scC50X,$scC50Y,$scC50Z);
$scC50b=xyz2lab("b",$scC50X,$scC50Y,$scC50Z);

/////////////////////////////////////////////////////////////
$RPCMX=lab2xyz("x",$RPCMl,$RPCMa,$RPCMb);
$RPCMY=lab2xyz("y",$RPCMl,$RPCMa,$RPCMb);
$RPCMZ=lab2xyz("z",$RPCMl,$RPCMa,$RPCMb);

$scMX=SCCA06("x",$RPCMX,$Xp,$target);
$scMY=SCCA06("y",$RPCMY,$Yp,$target);
$scMZ=SCCA06("z",$RPCMZ,$Zp,$target);

$scML=xyz2lab("l",$scMX,$scMY,$scMZ);
$scMa=xyz2lab("a",$scMX,$scMY,$scMZ);
$scMb=xyz2lab("b",$scMX,$scMY,$scMZ);

$RPCM50X=lab2xyz("x",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Y=lab2xyz("y",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Z=lab2xyz("z",$RPCM50l,$RPCM50a,$RPCM50b);

$scM50X=SCCA06("x",$RPCM50X,$Xp,$target);
$scM50Y=SCCA06("y",$RPCM50Y,$Yp,$target);
$scM50Z=SCCA06("z",$RPCM50Z,$Zp,$target);

$scM50L=xyz2lab("l",$scM50X,$scM50Y,$scM50Z);
$scM50a=xyz2lab("a",$scM50X,$scM50Y,$scM50Z);
$scM50b=xyz2lab("b",$scM50X,$scM50Y,$scM50Z);
////////////////////////////////////////////////////////////////
$RPCYX=lab2xyz("x",$RPCYl,$RPCYa,$RPCYb);
$RPCYY=lab2xyz("y",$RPCYl,$RPCYa,$RPCYb);
$RPCYZ=lab2xyz("z",$RPCYl,$RPCYa,$RPCYb);

$scYX=SCCA06("x",$RPCYX,$Xp,$target);
$scYY=SCCA06("y",$RPCYY,$Yp,$target);
$scYZ=SCCA06("z",$RPCYZ,$Zp,$target);

$scYL=xyz2lab("l",$scYX,$scYY,$scYZ);
$scYa=xyz2lab("a",$scYX,$scYY,$scYZ);
$scYb=xyz2lab("b",$scYX,$scYY,$scYZ);

$RPCY50X=lab2xyz("x",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Y=lab2xyz("y",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Z=lab2xyz("z",$RPCY50l,$RPCY50a,$RPCY50b);

$scY50X=SCCA06("x",$RPCY50X,$Xp,$target);
$scY50Y=SCCA06("y",$RPCY50Y,$Yp,$target);
$scY50Z=SCCA06("z",$RPCY50Z,$Zp,$target);

$scY50L=xyz2lab("l",$scY50X,$scY50Y,$scY50Z);
$scY50a=xyz2lab("a",$scY50X,$scY50Y,$scY50Z);
$scY50b=xyz2lab("b",$scY50X,$scY50Y,$scY50Z);
////////////////////////////////////////////////////////////////////
$RPCKX=lab2xyz("x",$RPCKl,$RPCKa,$RPCKb);
$RPCKY=lab2xyz("y",$RPCKl,$RPCKa,$RPCKb);
$RPCKZ=lab2xyz("z",$RPCKl,$RPCKa,$RPCKb);

$scKX=SCCA06("x",$RPCKX,$Xp,$target);
$scKY=SCCA06("y",$RPCKY,$Yp,$target);
$scKZ=SCCA06("z",$RPCKZ,$Zp,$target);

$scKL=xyz2lab("l",$scKX,$scKY,$scKZ);
$scKa=xyz2lab("a",$scKX,$scKY,$scKZ);
$scKb=xyz2lab("b",$scKX,$scKY,$scKZ);

$RPCK50X=lab2xyz("x",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Y=lab2xyz("y",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Z=lab2xyz("z",$RPCK50l,$RPCK50a,$RPCK50b);

$scK50X=SCCA06("x",$RPCK50X,$Xp,$target);
$scK50Y=SCCA06("y",$RPCK50Y,$Yp,$target);
$scK50Z=SCCA06("z",$RPCK50Z,$Zp,$target);

$scK50L=xyz2lab("l",$scK50X,$scK50Y,$scK50Z);
$scK50a=xyz2lab("a",$scK50X,$scK50Y,$scK50Z);
$scK50b=xyz2lab("b",$scK50X,$scK50Y,$scK50Z);
/////////////////////////////////////////////////////gray
$RPCgX=lab2xyz("x",$RPCgl,$RPCga,$RPCgb);
$RPCgY=lab2xyz("y",$RPCgl,$RPCga,$RPCgb);
$RPCgZ=lab2xyz("z",$RPCgl,$RPCga,$RPCgb);

$scgX=SCCA06("x",$RPCgX,$Xp,$target);
$scgY=SCCA06("y",$RPCgY,$Yp,$target);
$scgZ=SCCA06("z",$RPCgZ,$Zp,$target);

$scgL=xyz2lab("l",$scgX,$scgY,$scgZ);
$scga=xyz2lab("a",$scgX,$scgY,$scgZ);
$scgb=xyz2lab("b",$scgX,$scgY,$scgZ);

//echo "CRPC 6 SCCA <br> Cyan L:".round($scCL,2)."  a:".round($scCa,2)."  b:".round($scCb,2)."<br>Magenta L:".round($scML,2)."  a:".round($scMa,2)."  b:".round($scMb,2)."<br>Yellow L:".round($scYL,2)."  a:".round($scYa,2)."  b:".round($scYb,2)."<br>Black L:".round($scKL,2)."  a:".round($scKa,2)."  b:".round($scKb,2).  "<br />";


 
//////////////////////////////mc///////////////////////////////////////////////////////////
	 for ($s=1; $s<=20; $s+=1) {///////
	$Pdot=4+10*($s-1);
	//$Pdot=4;////////////////////////////////K100
 	${'mk'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mk'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mk'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'mk'.$s.'l'}=xyz2lab01("l",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'a'}=xyz2lab01("a",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'b'}=xyz2lab01("b",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	
	${'mk'.$s.'D'}=DensitySp38("K",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
		$Pdot=8+10*($s-1);;////////////////////////////K50
 
	//$Pdot=8;////////////////////////////////K50
 	${'mk50'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mk50'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mk50'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'mk50'.$s.'l'}=xyz2lab01("l",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'a'}=xyz2lab01("a",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'b'}=xyz2lab01("b",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	
	${'mk50'.$s.'D'}=DensitySp38("K",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'TVIk'.$s}=((($PX-0.55*$PZ)-(${'mk50'.$s.'x'}-0.55*${'mk50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mk'.$s.'x'}-0.55*${'mk'.$s.'z'})))*100;
	//echo "tvi;".${'TVIk'.$s}."xx";
	////////////////////////////////sec c
	$Pdot=1+10*($s-1);///////////////////////////////////////////////C100
 	${'mc'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mc'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mc'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'mc'.$s.'l'}=xyz2lab01("l",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'a'}=xyz2lab01("a",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'b'}=xyz2lab01("b",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	
	${'mc'.$s.'D'}=DensitySp38("C",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
		$Pdot=5+10*($s-1);//////////////////////////////////////////////C50
 	${'mc50'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mc50'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mc50'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'mc50'.$s.'l'}=xyz2lab01("l",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'a'}=xyz2lab01("a",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'b'}=xyz2lab01("b",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	
	${'mc50'.$s.'D'}=DensitySp38("C",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'TVIc'.$s}=((($PX-0.55*$PZ)-(${'mc50'.$s.'x'}-0.55*${'mc50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mc'.$s.'x'}-0.55*${'mc'.$s.'z'})))*100;

 ///////////////////////////////////////////////////////////////sec M
 $Pdot=2+10*($s-1);////////////////////M100
 	${'mm'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mm'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mm'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'mm'.$s.'l'}=xyz2lab01("l",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'a'}=xyz2lab01("a",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'b'}=xyz2lab01("b",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	
	${'mm'.$s.'D'}=DensitySp38("M",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	 $Pdot=6+10*($s-1);////////////////////M50
 	${'mm50'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mm50'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mm50'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'mm50'.$s.'l'}=xyz2lab01("l",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'a'}=xyz2lab01("a",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'b'}=xyz2lab01("b",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	
	${'mm50'.$s.'D'}=DensitySp38("M",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'TVIm'.$s}=((($PX-0.55*$PZ)-(${'mm50'.$s.'x'}-0.55*${'mm50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mm'.$s.'x'}-0.55*${'mm'.$s.'z'})))*100;
 ////////////////////////////////////sec Y
 $Pdot=3+10*($s-1);///////////////////////////////////////Y100
 	${'my'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'my'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'my'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'my'.$s.'l'}=xyz2lab01("l",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'a'}=xyz2lab01("a",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'b'}=xyz2lab01("b",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	
	${'my'.$s.'D'}=DensitySp38("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
  $Pdot=7+10*($s-1);///////////////////////////////////////Y50
 		${'my50'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'my50'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'my50'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'my50'.$s.'l'}=xyz2lab01("l",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'a'}=xyz2lab01("a",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'b'}=xyz2lab01("b",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	
	${'my50'.$s.'D'}=DensitySp38("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'TVIy'.$s}=((($PX-0.55*$PZ)-(${'my50'.$s.'x'}-0.55*${'my50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'my'.$s.'x'}-0.55*${'my'.$s.'z'})))*100;
	
	  $Pdot=9+10*($s-1);///////////////////////////////////////Gray
 	${'mg'.$s.'x'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mg'.$s.'y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'mg'.$s.'z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
 
	${'mg'.$s.'l'}=xyz2lab01("l",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'a'}=xyz2lab01("a",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'b'}=xyz2lab01("b",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	
	${'mg'.$s.'D'}=DensitySp38("K",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);

}///
	

	
?>


	

  


  <?php
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
	  
if ($fMarkC>0) { ////////////////////////////////////////////////////////////// ColorPort 400
	 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'WEIGHTING_FUNCTION ');
//echo "cols:".$cols."_zz<br>";
		//echo $contents[20]; 
		//echo $stringC; 
$string = implode($contents);		
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);
//echo $p;


$datastring=get_between($p,"BEGIN_DATA,",",END_DATA");

$dot = explode("\t", $datastring);
//print_r ($dot);
echo "<br>";	  
$Pdot=0;///paper line
//echo "take:".$dot[9+$cols*$Pdot-$Pdot];
          /////380-730 paper
$PX=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);

$PY=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);

$PZ=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);



//echo "take PX:".$PX."_Y:".$PY."_Z:".$PZ;



$PL=xyz2lab01("l",$PX,$PY,$PZ);
$Pa=xyz2lab01("a",$PX,$PY,$PZ);
$Pb=xyz2lab01("b",$PX,$PY,$PZ);

//$depaper=sqrt(pow((95-$PL),2)+ pow((1-$Pa),2)+pow(((4)-$Pb),2));
echo "CRPC6 paper: L:95,  a:1,  b:-4<br />";
echo "paper measured: L:".$PL.",  a:".$Pa.",  b:".$Pb.  "<br />";
//echo "CRPC 6 Paper: 95	1	-4,<br> Cyan:56	-37	-50".", Magenta:48	75	-4".", Yellow:89	-4	93".", Black:16	0	0".  "<br />";




$RPCCl=56;$RPCCa=-37;$RPCCb=-50;
$RPCMl=48;$RPCMa=75;$RPCMb=-4;
$RPCYl=89;$RPCYa=-4;$RPCYb=93;
$RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$RPCC50l=75.14;$RPCC50a=-16.63;$RPCC50b=-27.88;
$RPCM50l=70.07;$RPCM50a=35.98;$RPCM50b=-7.49;
$RPCY50l=91.49;$RPCY50a=-2.75;$RPCY50b=41.34;
$RPCK50l=60.4;$RPCK50a=0.46;$RPCK50b=-2.59;

$RPCgl=57.46;$RPCga=0.38;$RPCgb=-2.03;



$Xp=$PX*100;
$Yp=$PY*100;
$Zp=$PZ*100;
//////////////////////////////////////////////////////////////
$RPCCX=lab2xyz("x",$RPCCl,$RPCCa,$RPCCb);
$RPCCY=lab2xyz("y",$RPCCl,$RPCCa,$RPCCb);
$RPCCZ=lab2xyz("z",$RPCCl,$RPCCa,$RPCCb);

$scCX=SCCA06("x",$RPCCX,$Xp,$target);
$scCY=SCCA06("y",$RPCCY,$Yp,$target);
$scCZ=SCCA06("z",$RPCCZ,$Zp,$target);

$scCL=xyz2lab("l",$scCX,$scCY,$scCZ);
$scCa=xyz2lab("a",$scCX,$scCY,$scCZ);
$scCb=xyz2lab("b",$scCX,$scCY,$scCZ);

$RPCC50X=lab2xyz("x",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Y=lab2xyz("y",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Z=lab2xyz("z",$RPCC50l,$RPCC50a,$RPCC50b);

$scC50X=SCCA06("x",$RPCC50X,$Xp,$target);
$scC50Y=SCCA06("y",$RPCC50Y,$Yp,$target);
$scC50Z=SCCA06("z",$RPCC50Z,$Zp,$target);

$scC50L=xyz2lab("l",$scC50X,$scC50Y,$scC50Z);
$scC50a=xyz2lab("a",$scC50X,$scC50Y,$scC50Z);
$scC50b=xyz2lab("b",$scC50X,$scC50Y,$scC50Z);

/////////////////////////////////////////////////////////////
$RPCMX=lab2xyz("x",$RPCMl,$RPCMa,$RPCMb);
$RPCMY=lab2xyz("y",$RPCMl,$RPCMa,$RPCMb);
$RPCMZ=lab2xyz("z",$RPCMl,$RPCMa,$RPCMb);

$scMX=SCCA06("x",$RPCMX,$Xp,$target);
$scMY=SCCA06("y",$RPCMY,$Yp,$target);
$scMZ=SCCA06("z",$RPCMZ,$Zp,$target);

$scML=xyz2lab("l",$scMX,$scMY,$scMZ);
$scMa=xyz2lab("a",$scMX,$scMY,$scMZ);
$scMb=xyz2lab("b",$scMX,$scMY,$scMZ);

$RPCM50X=lab2xyz("x",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Y=lab2xyz("y",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Z=lab2xyz("z",$RPCM50l,$RPCM50a,$RPCM50b);

$scM50X=SCCA06("x",$RPCM50X,$Xp,$target);
$scM50Y=SCCA06("y",$RPCM50Y,$Yp,$target);
$scM50Z=SCCA06("z",$RPCM50Z,$Zp,$target);

$scM50L=xyz2lab("l",$scM50X,$scM50Y,$scM50Z);
$scM50a=xyz2lab("a",$scM50X,$scM50Y,$scM50Z);
$scM50b=xyz2lab("b",$scM50X,$scM50Y,$scM50Z);
////////////////////////////////////////////////////////////////
$RPCYX=lab2xyz("x",$RPCYl,$RPCYa,$RPCYb);
$RPCYY=lab2xyz("y",$RPCYl,$RPCYa,$RPCYb);
$RPCYZ=lab2xyz("z",$RPCYl,$RPCYa,$RPCYb);

$scYX=SCCA06("x",$RPCYX,$Xp,$target);
$scYY=SCCA06("y",$RPCYY,$Yp,$target);
$scYZ=SCCA06("z",$RPCYZ,$Zp,$target);

$scYL=xyz2lab("l",$scYX,$scYY,$scYZ);
$scYa=xyz2lab("a",$scYX,$scYY,$scYZ);
$scYb=xyz2lab("b",$scYX,$scYY,$scYZ);

$RPCY50X=lab2xyz("x",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Y=lab2xyz("y",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Z=lab2xyz("z",$RPCY50l,$RPCY50a,$RPCY50b);

$scY50X=SCCA06("x",$RPCY50X,$Xp,$target);
$scY50Y=SCCA06("y",$RPCY50Y,$Yp,$target);
$scY50Z=SCCA06("z",$RPCY50Z,$Zp,$target);

$scY50L=xyz2lab("l",$scY50X,$scY50Y,$scY50Z);
$scY50a=xyz2lab("a",$scY50X,$scY50Y,$scY50Z);
$scY50b=xyz2lab("b",$scY50X,$scY50Y,$scY50Z);
////////////////////////////////////////////////////////////////////
$RPCKX=lab2xyz("x",$RPCKl,$RPCKa,$RPCKb);
$RPCKY=lab2xyz("y",$RPCKl,$RPCKa,$RPCKb);
$RPCKZ=lab2xyz("z",$RPCKl,$RPCKa,$RPCKb);

$scKX=SCCA06("x",$RPCKX,$Xp,$target);
$scKY=SCCA06("y",$RPCKY,$Yp,$target);
$scKZ=SCCA06("z",$RPCKZ,$Zp,$target);

$scKL=xyz2lab("l",$scKX,$scKY,$scKZ);
$scKa=xyz2lab("a",$scKX,$scKY,$scKZ);
$scKb=xyz2lab("b",$scKX,$scKY,$scKZ);

$RPCK50X=lab2xyz("x",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Y=lab2xyz("y",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Z=lab2xyz("z",$RPCK50l,$RPCK50a,$RPCK50b);

$scK50X=SCCA06("x",$RPCK50X,$Xp,$target);
$scK50Y=SCCA06("y",$RPCK50Y,$Yp,$target);
$scK50Z=SCCA06("z",$RPCK50Z,$Zp,$target);

$scK50L=xyz2lab("l",$scK50X,$scK50Y,$scK50Z);
$scK50a=xyz2lab("a",$scK50X,$scK50Y,$scK50Z);
$scK50b=xyz2lab("b",$scK50X,$scK50Y,$scK50Z);
/////////////////////////////////////////////////////gray
$RPCgX=lab2xyz("x",$RPCgl,$RPCga,$RPCgb);
$RPCgY=lab2xyz("y",$RPCgl,$RPCga,$RPCgb);
$RPCgZ=lab2xyz("z",$RPCgl,$RPCga,$RPCgb);

$scgX=SCCA06("x",$RPCgX,$Xp,$target);
$scgY=SCCA06("y",$RPCgY,$Yp,$target);
$scgZ=SCCA06("z",$RPCgZ,$Zp,$target);

$scgL=xyz2lab("l",$scgX,$scgY,$scgZ);
$scga=xyz2lab("a",$scgX,$scgY,$scgZ);
$scgb=xyz2lab("b",$scgX,$scgY,$scgZ);

echo "CRPC 6 SCCA <br> Cyan L:".round($scCL,2)."  a:".round($scCa,2)."  b:".round($scCb,2)."<br>Magenta L:".round($scML,2)."  a:".round($scMa,2)."  b:".round($scMb,2)."<br>Yellow L:".round($scYL,2)."  a:".round($scYa,2)."  b:".round($scYb,2)."<br>Black L:".round($scKL,2)."  a:".round($scKa,2)."  b:".round($scKb,2).  "<br />";
?>

	<p><p>

  <?php
  //////////////////////////////////////////////////Fogra Media Check
  $psum=20;
 // $pl=95; $pa=-0.01;$pb=-2;

 for ($s=1; $s<=20; $s+=1) {///////
	$Pdot=4+10*($s-1);
	//$Pdot=4;////////////////////////////////K100
 	${'mk'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mk'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mk'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'mk'.$s.'l'}=xyz2lab01("l",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'a'}=xyz2lab01("a",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'b'}=xyz2lab01("b",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	
	${'mk'.$s.'D'}=DensitySp38("K",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
		$Pdot=8+10*($s-1);;////////////////////////////K50
 
	//$Pdot=8;////////////////////////////////K50
 	${'mk50'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mk50'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mk50'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'mk50'.$s.'l'}=xyz2lab01("l",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'a'}=xyz2lab01("a",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'b'}=xyz2lab01("b",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	
	${'mk50'.$s.'D'}=DensitySp38("K",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'TVIk'.$s}=((($PX-0.55*$PZ)-(${'mk50'.$s.'x'}-0.55*${'mk50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mk'.$s.'x'}-0.55*${'mk'.$s.'z'})))*100;
	//echo "tvi;".${'TVIk'.$s}."xx";
	////////////////////////////////sec c
	$Pdot=1+10*($s-1);///////////////////////////////////////////////C100
 	${'mc'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mc'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mc'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'mc'.$s.'l'}=xyz2lab01("l",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'a'}=xyz2lab01("a",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'b'}=xyz2lab01("b",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	
	${'mc'.$s.'D'}=DensitySp38("C",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
		$Pdot=5+10*($s-1);//////////////////////////////////////////////C50
 	${'mc50'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mc50'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mc50'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'mc50'.$s.'l'}=xyz2lab01("l",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'a'}=xyz2lab01("a",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'b'}=xyz2lab01("b",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	
	${'mc50'.$s.'D'}=DensitySp38("C",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'TVIc'.$s}=((($PX-0.55*$PZ)-(${'mc50'.$s.'x'}-0.55*${'mc50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mc'.$s.'x'}-0.55*${'mc'.$s.'z'})))*100;

 ///////////////////////////////////////////////////////////////sec M
 $Pdot=2+10*($s-1);////////////////////M100
 	${'mm'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mm'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mm'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'mm'.$s.'l'}=xyz2lab01("l",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'a'}=xyz2lab01("a",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'b'}=xyz2lab01("b",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	
	${'mm'.$s.'D'}=DensitySp38("M",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	 $Pdot=6+10*($s-1);////////////////////M50
 	${'mm50'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mm50'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mm50'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'mm50'.$s.'l'}=xyz2lab01("l",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'a'}=xyz2lab01("a",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'b'}=xyz2lab01("b",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	
	${'mm50'.$s.'D'}=DensitySp38("M",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'TVIm'.$s}=((($PX-0.55*$PZ)-(${'mm50'.$s.'x'}-0.55*${'mm50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mm'.$s.'x'}-0.55*${'mm'.$s.'z'})))*100;
 ////////////////////////////////////sec Y
 $Pdot=3+10*($s-1);///////////////////////////////////////Y100
 	${'my'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'my'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'my'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'my'.$s.'l'}=xyz2lab01("l",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'a'}=xyz2lab01("a",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'b'}=xyz2lab01("b",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	
	${'my'.$s.'D'}=DensitySp38("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
  $Pdot=7+10*($s-1);///////////////////////////////////////Y50
 		${'my50'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'my50'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'my50'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'my50'.$s.'l'}=xyz2lab01("l",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'a'}=xyz2lab01("a",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'b'}=xyz2lab01("b",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	
	${'my50'.$s.'D'}=DensitySp38("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'TVIy'.$s}=((($PX-0.55*$PZ)-(${'my50'.$s.'x'}-0.55*${'my50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'my'.$s.'x'}-0.55*${'my'.$s.'z'})))*100;
	
	  $Pdot=9+10*($s-1);///////////////////////////////////////Gray
 	${'mg'.$s.'x'}=sp38XYZ("X",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mg'.$s.'y'}=sp38XYZ("Y",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
	
	${'mg'.$s.'z'}=sp38XYZ("Z",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);
 
	${'mg'.$s.'l'}=xyz2lab01("l",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'a'}=xyz2lab01("a",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'b'}=xyz2lab01("b",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	
	${'mg'.$s.'D'}=DensitySp38("K",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35]);

}/////////////400 for loop
}////////////////////////////fMark ColorPort



	 ?>

<p><p>
	<table width="400" border="1" align="center">
  <tr>
	<td>
	<td colspan = "3">Original data</td>

	<td colspan = "3">SCCA data</td>

	</tr>
	<tr>
	<td>Paper</td>
	<td><?php echo $PTL;?></td>
	<td><?php echo $PTa;?></td>
	<td><?php echo $PTb;?></td>
	<td><?php echo  $PL;?></td>
	<td><?php echo  $Pa;?></td>
	<td><?php echo  $Pb;?></td>
	</tr>
	<tr>
	<td bgcolor="#00FFFF">100C</td>
	<td bgcolor="#00FFFF"><?php echo  $RPCCl;?></td>
	<td bgcolor="#00FFFF"><?php echo  $RPCCa;?></td>
	<td bgcolor="#00FFFF"><?php echo  $RPCCb;?></td>
	<td bgcolor="#00FFFF"><?php echo  round($scCL,2);?></td>
	<td bgcolor="#00FFFF"><?php echo  round($scCa,2);?></td>
	<td bgcolor="#00FFFF"><?php echo  round($scCb,2);?></td>
	</tr>
		<tr>
	<td bgcolor="#FFCCFF">100M</td>
	<td bgcolor="#FFCCFF"><?php echo  $RPCMl;?></td>
	<td bgcolor="#FFCCFF"><?php echo  $RPCMa;?></td>
	<td bgcolor="#FFCCFF"><?php echo  $RPCMb;?></td>
	<td bgcolor="#FFCCFF"><?php echo  round($scML,2);?></td>
	<td bgcolor="#FFCCFF"><?php echo  round($scMa,2);?></td>
	<td bgcolor="#FFCCFF"><?php echo  round($scMb,2);?></td>
	</tr>
	<td bgcolor="#FFFF66">100Y</td>
	<td bgcolor="#FFFF66"><?php echo  $RPCYl;?></td>
	<td bgcolor="#FFFF66"><?php echo  $RPCYa;?></td>
	<td bgcolor="#FFFF66"><?php echo  $RPCYb;?></td>
	<td bgcolor="#FFFF66"><?php echo  round($scYL,2);?></td>
	<td bgcolor="#FFFF66"><?php echo  round($scYa,2);?></td>
	<td bgcolor="#FFFF66"><?php echo  round($scYb,2);?></td>
	</tr>
	<td bgcolor="#BBBBBB">100K</td>
	<td bgcolor="#BBBBBB"><?php echo  $RPCKl;?></td>
	<td bgcolor="#BBBBBB"><?php echo  $RPCKa;?></td>
	<td bgcolor="#BBBBBB"><?php echo  $RPCKb;?></td>
	<td bgcolor="#BBBBBB"><?php echo  round($scKL,2);?></td>
	<td bgcolor="#BBBBBB"><?php echo  round($scKa,2);?></td>
	<td bgcolor="#BBBBBB"><?php echo  round($scKb,2);?></td>
	</tr>
	<td bgcolor="#CCFFFF">50C</td>
	<td bgcolor="#CCFFFF"><?php echo  $RPCC50l;?></td>
	<td bgcolor="#CCFFFF"><?php echo  $RPCC50a;?></td>
	<td bgcolor="#CCFFFF"><?php echo  $RPCC50b;?></td>
	<td bgcolor="#CCFFFF"><?php echo  round($scC50L,2);?></td>
	<td bgcolor="#CCFFFF"><?php echo  round($scC50a,2);?></td>
	<td bgcolor="#CCFFFF"><?php echo  round($scC50b,2);?></td>
	</tr>
		<td bgcolor="#FFDDFF">50M</td>
	<td bgcolor="#FFDDFF"><?php echo  $RPCM50l;?></td>
	<td bgcolor="#FFDDFF"><?php echo  $RPCM50a;?></td>
	<td bgcolor="#FFDDFF"><?php echo  $RPCM50b;?></td>
	<td bgcolor="#FFDDFF"><?php echo  round($scM50L,2);?></td>
	<td bgcolor="#FFDDFF"><?php echo  round($scM50a,2);?></td>
	<td bgcolor="#FFDDFF"><?php echo  round($scM50b,2);?></td>
	</tr>
		<td bgcolor="#FFFFCC">50Y</td>
	<td bgcolor="#FFFFCC"><?php echo  $RPCY50l;?></td>
	<td bgcolor="#FFFFCC"><?php echo  $RPCY50a;?></td>
	<td bgcolor="#FFFFCC"><?php echo  $RPCY50b;?></td>
	<td bgcolor="#FFFFCC"><?php echo  round($scY50L,2);?></td>
	<td bgcolor="#FFFFCC"><?php echo  round($scY50a,2);?></td>
	<td bgcolor="#FFFFCC"><?php echo  round($scY50b,2);?></td>
	</tr>
		<td bgcolor="#DDDDDD">50K</td>
	<td bgcolor="#DDDDDD"><?php echo  $RPCK50l;?></td>
	<td bgcolor="#DDDDDD"><?php echo  $RPCK50a;?></td>
	<td bgcolor="#DDDDDD"><?php echo  $RPCK50b;?></td>
	<td bgcolor="#DDDDDD"><?php echo  round($scK50L,2);?></td>
	<td bgcolor="#DDDDDD"><?php echo  round($scK50a,2);?></td>
	<td bgcolor="#DDDDDD"><?php echo  round($scK50b,2);?></td>
	</tr>
			<td bgcolor="#DDDCCF">504040</td>
	<td bgcolor="#DDDCCF"><?php echo  $RPCgl;?></td>
	<td bgcolor="#DDDCCF"><?php echo  $RPCga;?></td>
	<td bgcolor="#DDDCCF"><?php echo  $RPCgb;?></td>
	<td bgcolor="#DDDCCF"><?php echo  round($scgL,2);?></td>
	<td bgcolor="#DDDCCF"><?php echo  round($scga,2);?></td>
	<td bgcolor="#DDDCCF"><?php echo  round($scgb,2);?></td>
	</tr>

	</table>
	
	
		<p><p>
	
  <p>&nbsp;</p>
  <table border="1" align="center" cellpadding="0" cellspacing="0">
    <col width="87" />
    <col width="83" />
    <col width="71" span="2" />
    <col width="83" />
    <col width="56" />
    <col width="53" />
    <col width="83" />
    <col width="53" />
    <col width="56" />
    <col width="83" />
    <col width="47" span="2" />
    <col width="83" />
    <col width="63" span="2" />
    <col width="83" />
    <col width="56" />
    <col width="63" />
    <col width="83" />
    <col width="47" />
    <col width="49" />
    <col width="83" />
    <col width="47" />
    <col width="53" />
    <col width="83" />
    <col width="41" />
    <col width="47" />
    <tr>
      <td width="87"></td>
      <td colspan = "3" bgcolor="#00CCFF">Reference_C100</td>
<td colspan = "3" bgcolor="#FFCCFF">Reference_M100</td>
<td colspan = "3" bgcolor="#FFFF99">Reference_Y100</td>
<td colspan = "3" bgcolor="#CCCCCC">Reference_K100</td>
 
<td colspan = "3" bgcolor="#00DDFF">Reference_C50</td>
<td colspan = "3" bgcolor="#FFDDFF">Reference_M50</td>
<td colspan = "3" bgcolor="#FFFFDD">Reference_Y50</td>
<td colspan = "3" bgcolor="#CCCCCC">Reference_K50</td>
<td colspan = "3" bgcolor="#CCCCCC">Reference_50/40/40</td>
    </tr>
    <tr>
      <td></td>
      <td bgcolor="#00CCFF"><?php echo  round($scCL,2);?></td>
      <td bgcolor="#00CCFF"><?php echo  round($scCa,2);?></td>
      <td bgcolor="#00CCFF"><?php echo  round($scCb,2);?></td>
      <td bgcolor="#FFCCFF"><?php echo  round($scML,2);?></td>
      <td bgcolor="#FFCCFF"><?php echo  round($scMa,2);?></td>
      <td bgcolor="#FFCCFF"><?php echo  round($scMb,2);?></td>
      <td bgcolor="#FFFF99"><?php echo  round($scYL,2);?></td>
      <td bgcolor="#FFFF99"><?php echo  round($scYa,2);?></td>
      <td bgcolor="#FFFF99"><?php echo  round($scYb,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scKL,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scKa,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scKb,2);?></td>
      <td bgcolor="#00DDFF"><?php echo  round($scC50L,2);?></td>
      <td bgcolor="#00DDFF"><?php echo  round($scC50a,2);?></td>
      <td bgcolor="#00DDFF"><?php echo  round($scC50b,2);?></td>
      <td bgcolor="#FFDDFF"><?php echo  round($scM50L,2);?></td>
      <td bgcolor="#FFDDFF"><?php echo  round($scM50a,2);?></td>
      <td bgcolor="#FFDDFF"><?php echo  round($scM50b,2);?></td>
      <td bgcolor="#FFFFDD"><?php echo  round($scY50L,2);?></td>
      <td bgcolor="#FFFFDD"><?php echo  round($scY50a,2);?></td>
      <td bgcolor="#FFFFDD"><?php echo  round($scY50b,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scK50L,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scK50a,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scK50b,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scgL,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scga,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scgb,2);?></td>
    </tr>
    <tr>
      <td></td>
<td colspan = "3" bgcolor="#00CCFF">20 samples</td>
<td colspan = "3" bgcolor="#FFCCFF">20 samples</td>
<td colspan = "3" bgcolor="#FFFF99">20 samples</td>
<td colspan = "3" bgcolor="#CCCCCC">20 samples</td>
<td colspan = "3" bgcolor="#00DDFF">20 samples</td>
<td colspan = "3" bgcolor="#FFDDFF">20 samples</td>
<td colspan = "3" bgcolor="#FFFFDD">20 samples</td>
<td colspan = "3" bgcolor="#CCCCCC">20 samples</td>
<td colspan = "3" bgcolor="#CCCCCC">20 samples</td>
    </tr>
    <tr>
      <td>ID</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
    </tr>
    
	<?php 
	for ($s=1; $s<=20; $s+=1) {///////
	?>
	<tr>
      <td><?php echo $s;?></td>
      <td><?php echo  round(${'mc'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mc'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mc'.$s.'b'},2);?></td>
      <td><?php echo  round(${'mm'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mm'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mm'.$s.'b'},2);?></td>
      <td><?php echo  round(${'my'.$s.'l'},2);?></td>
      <td><?php echo  round(${'my'.$s.'a'},2);?></td>
      <td><?php echo  round(${'my'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mk'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mk'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mk'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mc50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mc50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mc50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mm50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mm50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mm50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'my50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'my50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'my50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mk50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mk50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mk50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mg'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mg'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mg'.$s.'b'},2);?></td>
	  </tr> 
	  <?php } ?>
      
 </table> 
 <br>
 <table border="1" align="center" cellpadding="1" cellspacing="1">
    <col width="87">
    <col width="83">
    <col width="71" span="2">
    <col width="83">
    <col width="56">
    <col width="53">
    <col width="83">
    <col width="53">
    <col width="56">
    <tr>
      <td width="87">Tol    CIEDE00</td>
      <td width="83" align="center" bgcolor="#00CCFF">C100</td>
      <td width="71" align="center" bgcolor="#FFCCFF">M100</td>
      <td width="71" align="center" bgcolor="#FFFF99">Y100</td>
      <td width="83" align="center" bgcolor="#CCCCCC">K100</td>
      <td width="56" align="center" bgcolor="#00CCFF">C50</td>
      <td width="53" align="center" bgcolor="#FFCCFF">M50</td>
      <td width="83" align="center" bgcolor="#FFFFCC">Y50</td>
      <td width="53" align="center" bgcolor="#CCCCCC">K50</td>
      <td width="56" align="center" bgcolor="#CCCCCC">50/40/40</td>
    </tr>
    <tr>
      <td>Level A</td>
      <td align="right" bgcolor="#00CCFF">1.50</td>
      <td align="right" bgcolor="#FFCCFF">1.50</td>
      <td align="right" bgcolor="#FFFF99">1.50</td>
      <td align="right" bgcolor="#CCCCCC">2.40</td>
      <td align="right" bgcolor="#00CCFF">1.50</td>
      <td align="right" bgcolor="#FFCCFF">1.50</td>
      <td align="right" bgcolor="#FFFFCC">1.50</td>
      <td align="right" bgcolor="#CCCCCC">1.50</td>
      <td align="right" bgcolor="#CCCCCC">3.00</td>
    </tr>
    <tr>
      <td>Level B</td>
      <td align="right" bgcolor="#00CCFF">2.4</td>
      <td align="right" bgcolor="#FFCCFF">2.4</td>
      <td align="right" bgcolor="#FFFF99">2.4</td>
      <td align="right" bgcolor="#CCCCCC">3.6</td>
      <td align="right" bgcolor="#00CCFF">2</td>
      <td align="right" bgcolor="#FFCCFF">2</td>
      <td align="right" bgcolor="#FFFFCC">2</td>
      <td align="right" bgcolor="#CCCCCC">2</td>
      <td align="right" bgcolor="#CCCCCC">3.5</td>
    </tr>
    <tr>
      <td>Level C</td>
      <td align="right" bgcolor="#00CCFF">4</td>
      <td align="right" bgcolor="#FFCCFF">4</td>
      <td align="right" bgcolor="#FFFF99">4</td>
      <td align="right" bgcolor="#CCCCCC">6</td>
      <td align="right" bgcolor="#00CCFF">2.5</td>
      <td align="right" bgcolor="#FFCCFF">2.5</td>
      <td align="right" bgcolor="#FFFFCC">2.5</td>
      <td align="right" bgcolor="#CCCCCC">2.5</td>
      <td align="right" bgcolor="#CCCCCC">5</td>
    </tr>
	    
	<?php 
	$rangeC = array();$rangeM = array();$rangeY = array();$rangeK = array();
	$rangeC50 = array();$rangeM50 = array();$rangeY50 = array();$rangeK50 = array();
	$rangeG = array();
	 for ( $i = 1; $i <= 20; $i+= 1) { 
	  ${'dec'.$i}=de00($RPCCl,$RPCCa,$RPCCb,${'mc'.$i.'l'},${'mc'.$i.'a'},${'mc'.$i.'b'});
	  ${'dem'.$i}=de00($RPCMl,$RPCMa,$RPCMb,${'mm'.$i.'l'},${'mm'.$i.'a'},${'mm'.$i.'b'});
	   ${'dey'.$i}=de00($RPCYl,$RPCYa,$RPCYb,${'my'.$i.'l'},${'my'.$i.'a'},${'my'.$i.'b'});
	    ${'dek'.$i}=de00($RPCKl,$RPCKa,$RPCKb,${'mk'.$i.'l'},${'mk'.$i.'a'},${'mk'.$i.'b'});
		${'dec50'.$i}=de00($RPCC50l,$RPCC50a,$RPCC50b,${'mc50'.$i.'l'},${'mc50'.$i.'a'},${'mc50'.$i.'b'});
		${'dem50'.$i}=de00($RPCM50l,$RPCM50a,$RPCM50b,${'mm50'.$i.'l'},${'mm50'.$i.'a'},${'mm50'.$i.'b'});
		${'dey50'.$i}=de00($RPCY50l,$RPCY50a,$RPCY50b,${'my50'.$i.'l'},${'my50'.$i.'a'},${'my50'.$i.'b'});
		${'dek50'.$i}=de00($RPCK50l,$RPCK50a,$RPCK50b,${'mk50'.$i.'l'},${'mk50'.$i.'a'},${'mk50'.$i.'b'});
		${'deg'.$i}=de00($RPCgl,$RPCga,$RPCgb,${'mg'.$i.'l'},${'mg'.$i.'a'},${'mg'.$i.'b'});
		
		$rangeC[$i] = ${'dec'.$i};
		$rangeM[$i] = ${'dem'.$i};
		$rangeY[$i] = ${'dey'.$i};
		$rangeK[$i] = ${'dek'.$i};
		$rangeC50[$i] = ${'dec50'.$i};
		$rangeM50[$i] = ${'dem50'.$i};
		$rangeY50[$i] = ${'dey50'.$i};
		$rangeK50[$i] = ${'dek50'.$i};
		$rangeG[$i] = ${'deg'.$i};
		
	 ?>
	 <tr>
      <td><?php echo $i;?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dec'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dem'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dey'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dek'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dec50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dem50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dey50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dek50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'deg'.$i},2);?></td>
	  </tr>
	  <?php 
	  } 
	  		
sort($rangeC);sort($rangeM);sort($rangeY);sort($rangeK);
sort($rangeC50);sort($rangeM50);sort($rangeY50);sort($rangeK50);
sort($rangeG);

$C95 = $rangeC[round((94/100) * count($rangeC) -0.5)];		
$M95 = $rangeM[round((94/100) * count($rangeM) -0.5)];		
$Y95 = $rangeY[round((94/100) * count($rangeY) -0.5)];		
$K95 = $rangeK[round((94/100) * count($rangeK) -0.5)];		
$C5095 = $rangeC50[round((94/100) * count($rangeC50) -0.5)];		
$M5095 = $rangeM50[round((94/100) * count($rangeM50) -0.5)];		
$Y5095 = $rangeY50[round((94/100) * count($rangeY50) -0.5)];		
$K5095 = $rangeK50[round((94/100) * count($rangeK50) -0.5)];		
$G95 = $rangeG[round((94/100) * count($rangeG) -0.5)];		
	  ?>    
	   <tr>
      <td>95th% </td>
	  
     <?php 	if ($C95<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($C95<2.40) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($C95<4.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($C95,2);?></td>
	
     <?php 	if ($M95<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($M95<2.40) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($M95<4.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($M95,2);?></td>
	
     <?php 	if ($Y95<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($Y95<2.40) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($Y95<4.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($Y95,2);?></td>
	
     <?php 	if ($K95<2.40) { 
	echo '<td bgcolor="#008000">';}
	elseif ($K95<3.60) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($K95<6.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($K95,2);?></td>
	
     <?php 	if ($C5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($C5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($C5095<2.50) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($C5095,2);?></td>
	
     <?php 	if ($M5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($M5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($M5095<2.50) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($M5095,2);?></td>
	
     <?php 	if ($Y5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($Y5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($Y5095<2.500) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($Y5095,2);?></td>
	
	
     <?php 	if ($K5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($K5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($K5095<2.500) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($K5095,2);?></td>
	
     <?php 	if ($G95<3.00) { 
	echo '<td bgcolor="#008000">';}
	elseif ($G95<3.50) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($G95<5.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($G95,2);?></td>
    </tr> 
		   
	<tr>
	  <td>Level</td>
    <?php  if ($C95<1.50) { 
	echo '<td>A</td>';}
	elseif ($C95<2.40) { 
	echo '<td>B</td>';}
	elseif ($C95<4.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($M95<1.50) { 
	echo '<td>A</td>';}
	elseif ($M95<2.40) { 
	echo '<td>B</td>';}
	elseif ($M95<4.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($Y95<1.50) { 
	echo '<td>A</td>';}
	elseif ($Y95<2.40) { 
	echo '<td>B</td>';}
	elseif ($Y95<4.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($K95<2.4) { 
	echo '<td>A</td>';}
	elseif ($K95<3.60) { 
	echo '<td>B</td>';}
	elseif ($K95<6.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($C5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($C5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($C5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($M5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($M5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($M5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($Y5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($Y5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($Y5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($K5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($K5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($K5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($G95<3.00) { 
	echo '<td>A</td>';}
	elseif ($G95<3.50) { 
	echo '<td>B</td>';}
	elseif ($G95<5.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>

    </tr> 
	
	<tr>
      <td>Score</td>
    <?php  if ($C95<1.50) { 
	$C95S=3;echo '<td>3</td>';}
	elseif ($C95<2.40) { 
	$C95S=2;echo '<td>2</td>';}
	elseif ($C95<4.00) { 
	$C95S=1;echo '<td>1</td>';}
	else {$C95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($M95<1.50) { 
	$M95S=3;echo '<td>3</td>';}
	elseif ($M95<2.40) { 
	$M95S=2;echo '<td>2</td>';}
	elseif ($M95<4.00) { 
	$M95S=1;echo '<td>1</td>';}
	else {$M95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($Y95<1.50) { 
	$Y95S=3;echo '<td>3</td>';}
	elseif ($Y95<2.40) { 
	$Y95S=2;echo '<td>2</td>';}
	elseif ($Y95<4.00) { 
	$Y95S=1;echo '<td>1</td>';}
	else {$Y95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($K95<2.4) { 
	$K95S=3;echo '<td>3</td>';}
	elseif ($K95<3.60) { 
	$K95S=2;echo '<td>2</td>';}
	elseif ($K95<6.00) { 
	$K95S=1;echo '<td>1</td>';}
	else {$K95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($C5095<1.50) { 
	$C5095S=3;echo '<td>3</td>';}
	elseif ($C5095<2.00) { 
	$C5095S=2;echo '<td>2</td>';}
	elseif ($C5095<2.50) { 
	$C5095S=1;echo '<td>1</td>';}
	else {$C5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($M5095<1.50) { 
	$M5095S=3;echo '<td>3</td>';}
	elseif ($M5095<2.00) { 
	$M5095S=2;echo '<td>2</td>';}
	elseif ($M5095<2.50) { 
	$M5095S=1;echo '<td>1</td>';}
	else {$M5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($Y5095<1.50) { 
	$Y5095S=3;echo '<td>3</td>';}
	elseif ($Y5095<2.00) { 
	$Y5095S=2;echo '<td>2</td>';}
	elseif ($Y5095<2.50) { 
	$Y5095S=1;echo '<td>1</td>';}
	else {$Y5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($K5095<1.50) { 
	$K5095S=3;echo '<td>3</td>';}
	elseif ($K5095<2.00) { 
	$K5095S=2;echo '<td>2</td>';}
	elseif ($K5095<2.50) { 
	$K5095S=1;echo '<td>1</td>';}
	else {$K5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($G95<3.00) { 
	$G95S=3;echo '<td>3</td>';}
	elseif ($G95<3.50) { 
	$G95S=2;echo '<td>2</td>';}
	elseif ($G95<5.00) { 
	$G95S=1;echo '<td>1</td>';}
	else {$G95S=0;echo '<td>0</td>';} ?>
	</tr>
	  
  </table>
  <hr size="5"> 
<p>Production Variation Chart<p>
 <p>
<table width="200" border="1" align="center"> 

<tr>
<td><div align="center">
<img src=<?php echo $CMYSIDN;?>>
</div></td>

<td><div align="center">

<img src=<?php echo $CMYSID_DN;?>>
</div></td>
</tr>
</table>
 
 <p>
 
 <table width="200" border="1" align="center">
<tr>
<td><div align="center">
<img src=<?php echo $KSIDN;?>>
</div></td>
<td><div align="center">

<img src=<?php echo $KSID_DN;?>>
</div></td>
</tr>
</table>
 <p>
 <table width="200" border="1" align="center"> 

<tr>
<td><div align="center">

<img src=<?php echo $CMYK50N;?>>
</div></td>
<td><div align="center">

<img src=<?php echo $CMYK50_TN;?>>
</div></td>
</tr>
</table>
<p>

<table width="200" border="1" align="center">
<tr>
<td><div align="center">

<img src=<?php echo $grayN;?>>
</div></td>
<td><div align="center">

<img src=<?php echo $gray_DN;?>>
</div></td>
</tr>
</table>


 <table>
 <tr>  
  <p>&copy; <a href="mailto:[email protected]">Fred Kuo</a>, 2014. All rights reserved.<br>
  <a href="http://www.fredkuo.idv.tw/wordpress/?p=1025">Read more.</a><br>
</p></td>
</tr>
</table>
</body>


</html>