fitsmgmt.naming.fits_newpath

fitsmgmt.naming.fits_newpath(
    fpath,
    rename_by,
    mkdir_by=None,
    header=None,
    delimiter='_',
    fillnan='',
    fileext='.fits',
)

Give the new path of a FITS file from header values.

Parameters

fpath : path - like

The path to the original FITS file.

rename_by : list of str

The keywords of the FITS header to rename by.

mkdir_by : list of str = None

The keys which will be used to make subdirectories to classify files. If given, subdirectories will be made with the header value of the keys. Default: None.

header : ~astropy.io.fits.Header object = None

The header to extract rename_by and mkdir_by. If None, the function will do header = fits.getheader(fpath). Default: None.

delimiter : str = '_'

The delimiter for the renaming. Default: '_'.

fillnan : str = ''

The string that will be inserted if the keyword is not found from the header. Default: ''.

fileext : str = '.fits'

The extension of the file name to be returned. Normally it should be '.fits' since this function is fits_newpath, but you may prefer, e.g., '.fit' for some reason. If fileext does not start with a period ("."), one is prepended automatically. Default: '.fits'.

Returns

newpath : path

The new path.