“样本match”的版本间差异
		
		
		
		
		
		跳到导航
		跳到搜索
		
				
		
		
	
无编辑摘要  | 
				|||
| 第1行: | 第1行: | ||
==python==  | 
|||
==一维数组的match==  | 
  |||
 ID1=list(zip(Brick,BOID))  | 
|||
[[astro_lib]]中的match和match2  | 
  |||
 ID2=list(zip(Brick2,BOID2))  | 
|||
*match,(数组中不能有重复)  | 
  |||
 xy,x_ind,y_ind=np.intersect1d(ID1,ID2,assume_unique=True,return_indices=True)  | 
|||
CALLING SEQUENCE:  | 
  |||
参见[https://numpy.org/doc/stable/reference/generated/numpy.intersect1d.html]  | 
|||
 match, a, b, suba, subb, [ COUNT =, /SORT, EPSILON =  ]  | 
  |||
''超大整数的match,比如SDSS的objID会出问题''  | 
  |||
==[[idl中宿主match]]  | 
|||
*match2可以用在某一样本是另外一个样本的子样本,这样可以完全匹配  | 
  |||
 match2,a,b,suba,subb  | 
  |||
如果a完全是b的子集,那么b[suba]=a  | 
  |||
'''该程序可用于找出子样本的补集'''  | 
  |||
 a=[3,2,1]  | 
  |||
 b=indgen(5)  | 
  |||
 match2,a,b,suba,subb  | 
  |||
 print,b[where(subb eq -1)]  | 
  |||
===多维数据的match===  | 
  |||
:matchnd  | 
  |||
==天球坐标的match==  | 
  |||
*[[idlutils]]中的spherematch  | 
  |||
:spherematch,Ra1,Dec1,Ra2,Dec2,matchlength,ID1,ID2,dis   | 
  |||
:'''注意matchlength的单位是度'''  | 
  |||
:我自己根据spherematch写了一个spherematch_kth,可以自动搜索在某个距离范围内,第kth个match [http://202.127.29.3/~shen/wiki/index.php/My_IDL_program#.E5.A4.A9.E6.96.87]  | 
  |||
:[[idlutils]]里面有djs_ANGLE_NMATCH 和djs_ANGLE_MATCH程序,功能类似。  | 
  |||
*[[sdssidl]]中有一个CLOSE_MATCH_RADEC  | 
  |||
2023年7月17日 (一) 13:12的版本
python
ID1=list(zip(Brick,BOID)) ID2=list(zip(Brick2,BOID2)) xy,x_ind,y_ind=np.intersect1d(ID1,ID2,assume_unique=True,return_indices=True)
参见[1]