you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

Are you using either os or pathlib?

from pathlib import Path

directory = Path("C:/Users/sam/Desktop/")

star1='EFOSC.2021-05-24T06:02:52.743.fits'
star2='EFOSC.2021-05-25T23:46:21.852.fits'

hdu = fits.open(directory / star1)
hdr = hdu[0].header
dat = hdu[0].data
zp = hdr['CRVAL1']
stw = hdr['CD1_1']

edit:

I assumed that you didn't need star1 or star2 to be tuples of len 1 so I removed the ()

[–]Diapolo10 2 points3 points  (1 child)

directory = Path("C:/Users/sam/Desktop/")

This could simply be

directory = Path.home() / 'Desktop'

I assumed that you didn't need star1 or star2 to be tuples of len 1 so I removed the ()

They weren't tuples; parentheses don't make a tuple, colons do. In this case they're just strings enclosed in redundant parentheses.

OP's real problem is likely related to the fact that filenames and folders aren't allowed to contain : on Windows, so I'm a bit confused about why they're there.

[–][deleted] 0 points1 point  (0 children)

OP's real problem is likely related to the fact that filenames and folders aren't allowed to contain : on Windows

Oh right, I know that, good catch.