Standard Forth versus Python: a case study

Paul Rubin http
Wed Oct 11 16:53:53 EDT 2006

John Doty <jpd at> writes:
> I have a bunch of image files in FITS format. For each raster row in
> each file, I need to determine the median pixel value and subtract it
> from all of the pixels in that row, and then write out the results as
> new FITS files.

I dunno what FITS is, but if you have a list of pixel values, that
calculation sounds like two lines:

   median = sorted(pixels)[len(pixels)//2]
   new_pixels = [p-median for p in pixels]

More information about the Python-list mailing list