fcmaker package

Submodules

fcmaker.fcmaker module

fcmaker.fcmaker.make_fc(p2uid=None, pswd=None, obids=[], bk_images=[], bk_lams=[], data_loc='./fcm_data', plot_loc='./fcm_plots', do_pdf=True, do_png=False, no_upload=False, systemtex=False, montage=False, clear_SkyView_cache=False, obsdate=None, do_parang=False, demo=False)

The main fcmaker function, to create finding charts from p2.

Parameters
  • p2uid – string. P2 user ID (will prompt if is None)

  • pswd – string. P2 user password (will prompt if is None)

  • obids – list of int. List of the P2 OB ID for which to generate finding charts

  • bk_images – list of string. Specify the FC background: SkyView survey name, None for default, or local FITS filename

  • bk_lams – list of string. Specify the wavelength of the background charts. None to read from FITS header.

  • data_loc – string. Relative path to the background images (local FITS files or SkyView images).

  • plot_loc – string. Relative path to the background images (local FITS files or SkyView images).

  • do_pdf – bool. Save a local PDF file ?

  • do_png – bool. Save a local png file ?

  • no_upload – bool. Skip the upload of finding charts to p2 ?

  • systemtex – bool. Use the system Latex instead of the Python latex ?

  • montage – bool. Use of Montage to rotate the fields with North up ?

  • clear_SkyView_cache – bool. Clear the SkyView cache ?

  • obsdate – string. Year (Month, Day, Hour, Minute, …) of the observation

  • do_parang – bool. Show the instrument field-of-view when a parallactic angle is required ?

  • demo – bool. Connect to the demo p2 server to process test OBs ? Will override p2uid and pswd.

fcmaker.fcmaker.make_fc_local(f, do_pdf=True, do_png=False, systemtex=False, montage=True, clear_SkyView_cache=False, obsdate=None, do_parang=False)

The other fcmaker function, to create finding charts from a local file.

Parameters
  • f – an open file, e.g. _io.TextIOWrapper from open(filename)

  • do_pdf – bool. Save a local PDF file ?

  • do_png – bool. Save a local png file ?

  • systemtex – bool. Use the system Latex instead of the Python latex ?

  • montage – bool. Use of Montage to rotate the fields with North up ?

  • clear_SkyView_cache – bool. Clear the SkyView cache ?

  • obsdate – string. Year (Month, Day, Hour, Minute, …) of the observation

  • do_parang – bool. Show the instrument field-of-view when a parallactic angle is required ?

fcmaker.fcmaker.set_fcmaker(systemtex, montage, clear_SkyView_cache, data_loc, plot_loc, do_parang)

A function that sets the generic options of fcmaker.

Parameters
  • no_systemtex – bool. True = use Python LaTex. False = System LaTeX.

  • no_montage – bool. True = do NOT use Montage.

  • clear_SkyView_cache – bool. True = clear the cache.

fcmaker.fcmaker.set_obsdate(obsdate)

A function that sets the obsdate parameter inside fcmaker.

Parameters

obsdate – string. The observing time (and date) for the OB. Should be parsable by dateutils.parser.parse(). None = now.

fcmaker.fcmaker.set_systemtex(systemtex)

A function that sets whether fcmaker uses the default system LateX, or not.

Parameters

no_systemtex – bool. True = use Python LaTex. False = System LaTeX.

fcmaker.fcmaker_espresso module

fcmaker.fcmaker_espresso.get_fields_dict(fc_params)

Create a dictionnary with the basic info required to draw the fields, given certain OB parameters.

Parameters

fc_params – A dictionnary containing the ESPRESSO OB parameters

Returns

A dictionary containing the plotting parameters for each field.

fcmaker.fcmaker_espresso.get_localfcdata_espresso(fc_params, inpars)

Extracts all the important info to build a finding chart from a given ESPRESSO OB defined locally.

Parameters

inpars – A dictionnary containing the OB parameters

Returns

A dictionnary containing the ESPRESSO OB parameters

fcmaker.fcmaker_espresso.get_p2fcdata_espresso(fc_params, ob, api)

Extracts all the important info to build a finding chart from a given ESPRESSO OB from p2.

Parameters
  • fc_params – dictionnary of finding chart parameters

  • ob – an api.getOB() object

  • api – a p2api.ApiConnection() object

Returns

A dictionnary containing the OB parameters

fcmaker.fcmaker_espresso.plot_field(ax1, ax2, fc_params, field)

The specific ESPRESSO function that draws a specific observation field.

Parameters
  • ax1,ax2 – the left and right plots ‘axis’

  • fc_params – the dictionnary of parameters for the OB

  • field – the specific field list of parameters

fcmaker.fcmaker_hawki module

fcmaker.fcmaker_hawki.detector_to_sky(dx, dy, pa)

Converts HAWKI offsets from the DETECTOR reference frame to the SKY reference frame.

Parameters
  • dx (float) – offset in arcsec

  • dy (float) – offset in arcsec

  • pa (float) – current position angle in degrees measured East-of-North (HAWKI convention)

Returns

the (dra,ddec) offsets in SKY convention.

Return type

tuple of floats

fcmaker.fcmaker_hawki.get_fields_dict(fc_params)

Create a dictionnary with the basic info required to draw the fields, given certain OB parameters.

Parameters

fc_params – A dictionnary containing the HAWKI OB parameters

Returns

A dictionary containing the plotting parameters for each field.

fcmaker.fcmaker_hawki.get_localfcdata_hawki(fc_params, inpars)

Extracts all the important info to build a finding chart from a given HAWKI OB defined locally.

Parameters

inpars – A dictionnary containing the OB parameters

Returns

A dictionnary containing the HAWKI OB parameters

fcmaker.fcmaker_hawki.get_p2fcdata_hawki(fc_params, ob, api)

Extracts all the important info to build a finding chart from a given HAWKI OB from p2.

Parameters
  • fc_params – dictionnary of finding chart parameters

  • ob – an api.getOB() object

  • api – a p2api.ApiConnection() object

Returns

A dictionnary containing the OB parameters

fcmaker.fcmaker_hawki.get_polygon(central_coord, pa, nx, ny, startx, starty)

Given the central location and position of a field, build a polygon to feed to matplotlib down the line.

Parameters
  • central_coord – an astropy.SkyCoord entry with the center of the HAWKI field

  • pa – the position angle of the field (p2 convention)

  • startx, starty (nx,ny,) – the Fast Phot windowing parameters

Returns

A list of 2-D coordinates for each corner of the field-of-view.

fcmaker.fcmaker_hawki.hawki_templates = ['HAWKI_img_acq_Preset', 'HAWKI_img_acq_PresetRRM', 'HAWKI_img_acq_MoveToPixel', 'HAWKI_img_acq_FastPhot', 'HAWKI_img_acq_FastPhotRRM', 'HAWKI_img_obs_GenericOffset', 'HAWKI_img_obs_AutoJitter', 'HAWKI_img_acq_LGS_Preset', 'HAWKI_img_acq_LGS_PresetRRM', 'HAWKI_img_acq_LGS_MoveToPixel', 'HAWKI_img_acq_LGS_FastPhot']

List all the supported HAWKI observing templates (incl. Fast Phot)

fcmaker.fcmaker_hawki.plot_field(ax1, ax2, fc_params, field)

The specific HAWKI function that draws a specific observation field.

Parameters
  • ax1,ax2 – the left and right plots ‘axis’

  • fc_params – the dictionnary of parameters for the OB

  • field – the specific field list of parameters

fcmaker.fcmaker_instrument_dispatch module

fcmaker.fcmaker_instrument_dispatch.get_GS_outer_radius(fc_params)

Returns the outer search radius for different instruments.

Parameters

fc_params – the parameters of the finding charts (a dictionary)

Returns

the radius in arcsec.

Return type

radius

fcmaker.fcmaker_instrument_dispatch.get_bk_image(fc_params)

Returns the default SkyView survey name for all supported instruments.

Parameters

fc_params – the parameters of the finding chart (a dictionnary)

Returns

The survey name as a string

fcmaker.fcmaker_instrument_dispatch.get_chart_center(fc_params)

Defines the center of the right and left plots for different instruments.

Parameters

fc_params – the parameters of the finding charts (a dictionary)

Returns

a tuple with the chart center as a SkyCoord value.

Return type

(left_center, right_center)

fcmaker.fcmaker_instrument_dispatch.get_chart_radius(fc_params)

Defines the radius of the right and left plots for different instruments.

Parameters

fc_params – the parameters of the finding charts (a dictionary)

Returns

a tuple with the chart radius in arcsec.

Return type

(left_radius, right_radius)

fcmaker.fcmaker_instrument_dispatch.get_fields_dict(fc_params)

Returns the dictionnary of the field plotting parameters, given certain fc parameters.

Parameters

fc_params – the parameters of the finding chart (a dictionnary)

Returns

A dictionary of lists.

fcmaker.fcmaker_instrument_dispatch.get_gaia_image_params(fc_params)

Returns the outer search radius for different instruments.

Parameters

fc_params – the parameters of the finding charts (a dictionary)

Returns

the sampling and fwhm to build a fake Gaia image

Return type

(sampling,fwhm)

A function to get theinner search radius for Gudie Stars, as a function of the instrument.

Parameters

fc_params – the parameters of the finding charts (a dictionary)

Returns

the radius value, in arcsec

Return type

radius (float)

fcmaker.fcmaker_instrument_dispatch.get_localfcdata(inpars)

Extract the required info for creating a finding chart from the ob and templates obtained from a local parameter file.

Parameters

inpars – a dictionnary.

Returns

a dictionnary containing the OB parameters

fcmaker.fcmaker_instrument_dispatch.get_p2fcdata(obID, api)

Extract the required info for creating a finding chart from the ob and templates obtained via p2api.

Parameters
  • obID – the OB Id, as an integer.

  • api – a p2api.ApiConnection() object

Returns

a dictionnary containing the OB parameters

fcmaker.fcmaker_instrument_dispatch.get_pmin(survey)

A function to get the pmin value for the aplpy chart, as a function of the instrument.

Parameters

fc_params – the parameters of the finding charts (a dictionary)

Returns

the pmin value

Return type

pmin (float)

fcmaker.fcmaker_instrument_dispatch.get_scalebar(inst, ins_mode=None)

Sets the scalebar of the chart, as a function of the instrument

Parameters

inst (string) – the instrument name

Returns

tuple with the scalebar length (in degrees) and label

Return type

(scl, scll)

fcmaker.fcmaker_instrument_dispatch.get_target_from_ephem(fc_params, ephemeris)

A function to extract the target coordinates and other useful stuff from a PAF ephemeris file.

Parameters
  • fc_params – the parameters of the finding charts (a dictionary)

  • ephemeris – the content of a PAF files as a list of strings from readlines()

Returns

the updated parameters of the finding charts (a dictionary)

Return type

fc_params

fcmaker.fcmaker_instrument_dispatch.get_total_right_radius(fc_params, right_radius)

A function to compute the total right radius given the offsets within the OB.

Parameters
  • fc_params – dictionnary of OB parameters

  • right_radius – default right radius

Returns

updated right_radius

Return type

right_radius

fcmaker.fcmaker_instrument_dispatch.plot_field(ax1, ax2, fc_params, field)

Triggers the plotting of a specific field.

Parameters
  • ax1,ax2 – the left and right plots ‘axis’

  • fc_params – the dictionnary of parameters for the OB

  • field – the specific field list of parameters

fcmaker.fcmaker_metadata module

fcmaker.fcmaker_muse module

fcmaker.fcmaker_muse.detector_to_sky(dx, dy, pa)

Converts MUSE offsets from the DETECTOR reference frame to the SKY reference frame.

Parameters
  • dx (float) – offset in arcsec

  • dy (float) – offset in arcsec

  • pa (float) – current position angle in degrees measured East-of-North (MUSE convention)

Returns

the (dra,ddec) offsets in SKY convention.

Return type

tuple of floats

Note

According to the MUSE User manual, “when in DETECTOR framework, if both telescope offsets and PA offsets are provided, the telescope offsets are sent (first) with respect to the current PA of the instrument, before applying the PA offset.”

fcmaker.fcmaker_muse.get_fields_dict(fc_params)

Create a dictionnary with the basic info required to draw the fields, given certain OB parameters.

Parameters

fc_params – A dictionnary containing the MUSE OB parameters

Returns

A dictionary containing the plotting parameters for each field.

fcmaker.fcmaker_muse.get_localfcdata_muse(fc_params, inpars)

Extracts all the important info to build a finding chart from a given MUSE OB defined locally.

Parameters

inpars – A dictionnary containing the OB parameters

Returns

A dictionnary containing the MUSE OB parameters

fcmaker.fcmaker_muse.get_p2fcdata_muse(fc_params, ob, api)

Extracts all the important info to build a finding chart from a given MUSE OB from p2.

Parameters
  • fc_params – dictionnary of finding chart parameters

  • ob – an api.getOB() object

  • api – a p2api.ApiConnection() object

Returns

A dictionnary containing the OB parameters

fcmaker.fcmaker_muse.get_polygon(central_coord, pa, mode)

Given the central location and position of a field, build a polygon to feed to matplotlib down the line.

Parameters
  • central_coord – an astropy.SkyCoord entry with the center of the MUSE field

  • pa – the position angle of the field (p2 convention)

  • mode – the instrument mode, either ‘WFM’ or ‘NFM’

Returns

A list of 2-D coordinates for each corner of the field-of-view.

fcmaker.fcmaker_muse.left_radius(ins_mode)

A function that sets the defaut size of the left window depending on the mode.

fcmaker.fcmaker_muse.plot_field(ax1, ax2, fc_params, field)

The specific MUSE function that draws a specific observation field.

Parameters
  • ax1,ax2 – the left and right plots ‘axis’

  • fc_params – the dictionnary of parameters for the OB

  • field – the specific field list of parameters

fcmaker.fcmaker_plots module

fcmaker.fcmaker_plots.add_orient(ax, field_center, radius=<Quantity 540. arcsec>, arrow_width=<Quantity 120. arcsec>, usetex=True)

Plot some N-E orientation arrows

Rely on the show_arrow function from aplpy, which should be able to deal with any image orientation, even is North /= up.

Parameters
  • ax – the aplpy ax instance to add the arrows to

  • field_center – a SkyCoord entry marking the central pointing of the chart

  • radius – the distance from the field_center to draw the arrows at, in arcsec.

  • arrow_width – the arrow size, in arcsec

  • usetex – whether a system LaTeX is used, or not

fcmaker.fcmaker_plots.draw_fc(fc_params, bk_image=None, bk_lam=None, do_pdf=False, do_png=False)

The finding chart master plotting function.

Parameters
  • fc_params – a dictionnary containing the OB parameters

  • bk_image – the background image as string, either a SkyView entry, or local filename

  • bk_lam – the wavelength of the chart as a string

  • do_pdf (bool) – save a pdf file, in addition to jpg

  • do_png (bool) – save a png file, in addition to jpg

Returns

The finding chart filename as a string

fcmaker.fcmaker_plots.get_bk_image(bk_image, bk_lam, center, radius, fc_params)

A function that fetches the background image from the web, or locally if specified by the user.

Parameters
  • bk_image – (string) defines whether to use a local image (FITS filename) or a SkyView image (survey name).

  • bk_lam – (string)

  • center – a SkyCoord entry defining the center of the image

  • radius – the radius of the image … for now, only used when creating a pseudo-Gaia image

  • fc_params – the parameters of the finding chart (a dictionary)

Returns

The absolute path of the background image (possibly after download), and the survey name.

Note

For local images, the code expect them to be stored in fcm_m.data_loc folder.

fcmaker.fcmaker_plots.get_bk_image_lam(fn_bk_image, fc_params)

Reads the wavelength of the background image from the header. Assumes SkyView image.

Parameters

fn_bk_image – path to background image FITS file. fc_params: the parameters of the finding chart (a dictionnary)

Returns

The image wavelength range as a string.

fcmaker.fcmaker_plots.make_gaia_image(skycoord, fov, sampling, fwhm, obsdate=datetime.datetime(2018, 7, 1, 0, 0, tzinfo=tzutc()), fn='./pseudo_gaia.fits')

Given a coordinate, use the Gaia catalogue to create a mock image of the sky.

Parameters
  • skycoord – the astropy SkyCoord of the center of the image

  • fov – size of the image to create, in astropy.units

  • sampling – pixel size of the image to create, in astropy.units

  • fwhm – fwhm of the fake stars in the image, in astropy.units

  • obsdate – date of the observation (to propagate the motion of the stars) as datetime.datetime object

  • fn – relative path + FITS filename

Returns

The FITS filename

fcmaker.fcmaker_tools module

fcmaker.fcmaker_tools.all_surveys()
fcmaker.fcmaker_tools.blind_offset(coord_start, coord_end)

Compute the offsets between two astropy.sky_coordinate.SkyCoord positions. This function assumes that the sky is flat, and only really makes sense for positions within 15 arcmin.

Parameters
  • coord_start – a SkyCoord object

  • coord_end – a SkyCoord object

Returns

The offsets in arcsec

fcmaker.fcmaker_tools.crosshair(inner_r=1, pa=0)

The PATH of acrosshair, useful for indicating targets without crowding the field.

Parameters
  • inner_r – the (relative) inner radius. Default=1

  • pa – the position anglem in degrees

Returns

A mpl.path.Path() object.

fcmaker.fcmaker_tools.myrotmatrix(angle)

Defines a clockwise rotation matrix given a certain rotation angle. There is probably a smarter way to do this …

Parameters

angle – a rotation angle in degree

Returns

a 2D numpy array

fcmaker.fcmaker_tools.offset_coord(coord_start, delta_ra=<Quantity 0. arcsec>, delta_dec=<Quantity 0. arcsec>)

Compute a new SkyCoord entity given a starting location and offset. This function assumes that the sky is flat!

Parameters
  • coord_start – a SKyCoord object

  • delta_ra – an RA offset, in u.arcsec

  • delta_dec – an Dec offset, in u.arcsec

Returns

a SkyCoord object

fcmaker.fcmaker_version module

fcmaker: a Python module to automatically create finding charts for ESO OBs in p2.

Copyright (C) 2017-2019, F.P.A. Vogt

— oOo —

This file contains the version of fcmaker.

Created September 2019, F.P.A. Vogt - frederic.vogt@alumni.anu.edu.au

fcmaker.fcmaker_xshooter module

fcmaker.fcmaker_xshooter.detector_to_sky(dx, dy, pa)

Converts XSHOOTER offsets from the DETECTOR reference frame to the SKY reference frame.

Parameters
  • dx (float) – offset in arcsec

  • dy (float) – offset in arcsec

  • pa (float) – current position angle in degrees measured East-of-North (XSHOOTER convention)

Returns

the (dra,ddec) offsets in SKY convention.

Return type

tuple of floats

fcmaker.fcmaker_xshooter.get_fields_dict(fc_params)

Create a dictionnary with the basic info required to draw the fields, given certain OB parameters.

Parameters

fc_params – A dictionnary containing the XSHOOTER OB parameters

Returns

A dictionary containing the plotting parameters for each field.

fcmaker.fcmaker_xshooter.get_localfcdata_xshooter(fc_params, inpars)

Extracts all the important info to build a finding chart from a given XSHOOTER OB defined locally.

Parameters

inpars – A dictionnary containing the OB parameters

Returns

A dictionnary containing the XSHOOTER OB parameters

fcmaker.fcmaker_xshooter.get_p2fcdata_xshooter(fc_params, ob, api)

Extracts all the important info to build a finding chart from a given XSHOOTER OB from p2.

Parameters
  • fc_params – dictionnary of finding chart parameters

  • ob – an api.getOB() object

  • api – a p2api.ApiConnection() object

Returns

A dictionnary containing the OB parameters

fcmaker.fcmaker_xshooter.get_polygon(central_coord, pa, fov)

Given the central location and position of a field, build a polygon to feed to matplotlib down the line.

Parameters
  • central_coord – an astropy.SkyCoord entry with the center of the XSHOOTER field

  • pa – the position angle of the field (p2 convention)

  • fov – length 2 list, with the size of the Field-of-View (in angular astropy.units)

Returns

A list of 2-D coordinates for each corner of the field-of-view.

fcmaker.fcmaker_xshooter.plot_field(ax1, ax2, fc_params, field)

The specific XSHOOTER function that draws a specific observation field.

Parameters
  • ax1,ax2 – the left and right plots ‘axis’

  • fc_params – the dictionnary of parameters for the OB

  • field – the specific field list of parameters

Module contents

fcmaker: a Python module to automatically create finding charts for ESO OBs in p2.

Copyright (C) 2017-2019, F.P.A. Vogt — oOo —

This file defines what functions are accessible to the user. Created October 2017, F.P.A. Vogt - frederic.vogt@alumni.anu.edu.au

— oOo —

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.