Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2005 Joint Institute for VLBI in Europe 2 # 3 # This program is free software; you can redistribute it and/or modify 4 # it under the terms of the GNU General Public License as published by 5 # the Free Software Foundation; either version 2 of the License, or 6 # (at your option) any later version. 7 # 8 # This program is distributed in the hope that it will be useful, 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # GNU General Public License for more details. 12 13 # You should have received a copy of the GNU General Public License 14 # along with this program; if not, write to the Free Software 15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 17 """ 18 19 This module provides some utility functions for dealing with AIPS. 20 21 """ 2224 """Convert a number into "extended hex". 25 26 Returns the extended hex presentation for N, optionally padding it 27 up to WIDTH with PADDING.""" 28 29 ehex_digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' 30 result = '' 31 32 while n > 0: 33 result = ehex_digits[n % len(ehex_digits)] + result 34 n /= len(ehex_digits) 35 width -= 1 36 continue 37 38 # Pad if requested to do so. 39 if padding != None: 40 while width > 0: 41 result = str(padding) + result 42 width -= 1 43 continue 44 pass 45 46 return result47
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Nov 28 17:13:11 2008 | http://epydoc.sourceforge.net |