Re: 3 second question
- To: mathgroup at smc.vnet.net
- Subject: [mg70965] Re: 3 second question
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 3 Nov 2006 01:39:11 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <eicn1n$fri$1@smc.vnet.net>
kevin_jazz wrote:
> I've been away from Mathematica for a couple of months and I feel like
> I've forgotten everything. Here's a basic question:
> I've copied the following from my notebook:
>
> In[9]:=
> vals =
> Import["/Users/kbowman/TES/Limb/RetrievalOutputAtomicVals.asc","List"]
>
> Out[9]=
> {TES_File_ID,=,L2_RetrievalOutput,Diagnostic,Atomic,Values,Creation_Date,=,\
> Tue,03-Oct-2006,14:10:53,Data_Size,=,0,x,0,NumCompletedIterations,=,5,\
> BestIterationNumber,=,4,Converged,=,YES,BestResidualNorm,=,1.02662,\
> BestPointingAngle,=,1.12479,BestCloudODFactor,=,0,ErrorSurfaceLinearity(rho),=\
> ,1.1324,IncrementSizeControlParameter(lambda),=,0.,TrustRegion,(delta),=,2.\
> 07864,CostFunctionDerivative,=,1.04831,StateVectorChange,=,0.0000974532,\
> CostFunctionChange,=,0.0000585313,StopCode,=,3,StopCodeDescription,=,\
> Convergence,reached:,costFuncDerivative,<=,sqrt(threshold),AND,\
> stateVectorChange,<=,sqrt(threshold),AND,costFuncChange,<=,threshold,(Stop,\
> Code,3).,End_of_Header,****,End_of_Header,****,End_of_Header,****,End_of_\
> Header}
>
> In[29]:=
> retfiles =
> FileNames["RetrievalOutputAtomicVals*","/Users/kbowman/TES/",3]
>
> Out[29]=
> {/Users/kbowman/TES/Limb/RetrievalOutputAtomicVals2.asc,/Users/kbowman/TES/\
> Limb/RetrievalOutputAtomicVals.asc}
>
> In[32]:=
> vals=Map[Import[#,"List"]&,retfiles]
>
> Out[32]=
> {{TES_File_ID,=,L2_RetrievalOutput,Diagnostic,Atomic,Values,Creation_Date,=,\
> Tue,03-Oct-2006,14:10:53,Data_Size,=,0,x,0,
>
> NumCompletedIterations,=,5,BestIterationNumber,=,4,Converged,=,YES,\
> BestResidualNorm,=,1.02662,BestPointingAngle,=,
> 1.12479,BestCloudODFactor,=,0,ErrorSurfaceLinearity(rho),=,
>
> 1.1324,IncrementSizeControlParameter(lambda),=,0.,TrustRegion,(delta),=,
> 2.07864,CostFunctionDerivative,=,1.04831,StateVectorChange,=,
> 0.0000974532,CostFunctionChange,=,0.0000585313,StopCode,=,3,\
> StopCodeDescription,=,Convergence,reached:,costFuncDerivative,<=,sqrt(\
> threshold),AND,stateVectorChange,<=,sqrt(threshold),AND,costFuncChange,<=,\
> threshold,(Stop,Code,3).,End_of_Header,****,
> End_of_Header,****,End_of_Header,****,End_of_Header},{
>
> TES_File_ID,=,L2_RetrievalOutput,Diagnostic,Atomic,Values,Creation_Date,=,\
> Tue,03-Oct-2006,13:48:52,Data_Size,=,0,x,0,NumCompletedIterations,=,2,\
> BestIterationNumber,=,2,Converged,=,YES,BestResidualNorm,=,0.990839,\
> BestPointingAngle,=,1.12538,BestCloudODFactor,=,0,ErrorSurfaceLinearity(rho),=\
> ,0.925106,IncrementSizeControlParameter(lambda),=,0.,TrustRegion,(delta),=,37.\
> 0709,CostFunctionDerivative,=,0.285889,StateVectorChange,=,0.000286536,\
> CostFunctionChange,=,0.00382743,StopCode,=,3,StopCodeDescription,=,\
> Convergence,reached:,costFuncDerivative,<=,sqrt(threshold),AND,\
> stateVectorChange,<=,sqrt(threshold),AND,costFuncChange,<=,threshold,(Stop,
> Code,3).,End_of_Header,****,End_of_Header,****,End_of_Header,****,
> End_of_Header}}
>
> \!\(p\_res = \([vals, "\<BestResidualNorm\>"]\)\)
>
> Out[33]=
> {{1,26},{2,26}}
>
> All I want to do right now is to use p_res to extract the elements in
> the list vals given the positions provided in p_res. I tried several
> things including the following:
>
> \!\(p\_res /. {x_, y_} \[Rule] vals[\([x, y]\)]\)
>
> It doesn't work. Can someone tell me how to do this?
>
> Thanks for your forbearance,
>
> Kevin
>
Hi Kevinn,
Extract[vals, p_res]
should do it.
Regards,
Jean-Marc