skip to main | skip to sidebar

BTD

A blog about astrophysics & computing. More info about me @ Adam Ginsburg's page

Tuesday, October 28, 2008

Python magic / advanced numpy indexing

Yeah, indexing python arrays should really be easy.

Stefan van der Walt's page


In [85]: bi = (f.bolo_indices[np.newaxis,:] + zeros([7751,1])).astype('int')

In [86]: whc = (whscan[:,np.newaxis] + zeros([1,107])).astype('int')

In [87]: array2d[whc,bi] = temp2d
Posted by Adam at 10:19 PM
Labels: python

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2013 (1)
    • ►  September (1)
  • ►  2010 (25)
    • ►  November (2)
    • ►  August (2)
    • ►  July (2)
    • ►  June (1)
    • ►  May (3)
    • ►  April (1)
    • ►  March (4)
    • ►  February (8)
    • ►  January (2)
  • ►  2009 (41)
    • ►  December (1)
    • ►  November (1)
    • ►  October (6)
    • ►  August (6)
    • ►  July (5)
    • ►  June (5)
    • ►  May (4)
    • ►  April (7)
    • ►  February (2)
    • ►  January (4)
  • ▼  2008 (94)
    • ►  December (5)
    • ►  November (7)
    • ▼  October (16)
      • Python magic / advanced numpy indexing
      • Python: one-line arrays
      • Port vs Fink
      • Reinstalling a system
      • Python: setting matplotlib defaults
      • Observing 10/20
      • Screen, nohup, ssh, scp
      • Listing variables (e.g IDL help) in Python
      • SAVE / RESTORE in Python
      • Last month's observations in L111
      • How do I print a multi-page postscript?
      • Mathematica & Series expansions
      • teaching
      • gardening
      • sage casjobs
      • mathematica
    • ►  September (19)
    • ►  August (14)
    • ►  July (33)
 

Homepage

  • Adam Ginsburg's homepage

Categories

agpy (2) animation (1) art (1) astronomers (2) astronomy (21) baking (1) bash (1) beer (4) beer tasting (12) bgps (3) bitters (1) brewing (1) comic (4) computer (51) ds9 (4) gardening (1) gnuplot (1) grad school (2) humor (1) idl (1) internet (2) iraf (3) l111 (1) latex (5) mac (5) marketable skills (1) mathematica (1) matplotlib (3) me (4) meta (5) movie review (4) nrao (1) observing (3) pdf (3) photo (4) postscript (6) python (23) review (2) security (1) song (1) ssh (1) teaching (1) travel (1) ultimate (1) unix (4)

Contributors

  • Adam
  • Buffalo