Package: salt-finder-charts
SALT Finder ChartsGenerate finder charts for the Southern African Large Telescope (SALT).This package will change...This is a preliminary and rudimentary version, and you should expect major changes in future versions.InstallationThe package can be installed with pip.pipinstallsalt_finder_chartsUsageYou can generate finder charts with thestandard_finder_chartfunction. This returns a generator of binary streams containing the finder charts. For example, this is how you would generate finder charts for a longslit observation of an 18th magnitude target.importastropy.unitsasufromsalt_finder_chartsimportstandard_finder_chartsfromsalt_finder_charts.modeimportModefromsalt_finder_charts.outputimportOutputFormatfcs=standard_finder_charts(bandpass="V",dec=-27.63792*u.deg,max_magnitude=18,min_magnitude=18,mode=Mode.LONGSLIT,output_format=OutputFormat.PDF,position_angle=0*u.deg,ra=78.6568723*u.deg,slitwidth=2*u.arcsec,title="Test Finding Chart")Why a generator? Isn't there a single finder chart only? Usually that's true. However, in case of an asteroid you may get multiple finder charts, in particular if the considered time interval covers multiple nights.Saving the generated finder charts to disk is fairly straightforward.counter=1forfcinfcs:withopen(f"FindingChart-{counter}.pdf","wb")asf:f.write(fc.read())counter+=1If you are certain there is only one finder chart, you could just usenext()to get it.fc=next(fcs)Here is how you could view finder charts for an asteroid. Note that both the pytz and the Pillow library must have been installed, and that you have to hit enter for moving to the next finder chart.fromdatetimeimportdatetimefromPILimportImageimportpytzimportastropy.unitsasufromsalt_finder_chartsimportstandard_finder_chartsfromsalt_finder_charts.modeimportModefromsalt_finder_charts.outputimportOutputFormatutc=pytz.timezone("UTC")start=utc.localize(datetime(2019,6,28,11,31,0))end=utc.localize(datetime(2019,6,29,12,31,0))forfcinstandard_finder_charts(mode=Mode.IMAGING,horizons_id='54827',start_time=start,end_time=end,slitwidth=2*u.arcsec,basic_annotations=False,output_format=OutputFormat.PNG):image=Image.open(fc)image.show()input('Press enter to continue')image.close()Thestandard_finder_chartsfunction accepts the following arguments.ArgumentDescriptionDefaultbandpassBandpass for the magnitudes, such as V.basic_annotationsWhether to add basic annotations only.FalsedecDeclination of the finder chart center, as an angle between -90 and 90 degrees.end_timeEnd time until which to generate finder charts. This is only relevant for non-sidereal targets. Must be timezone-aware.End of the current Julian dayhorizons_idIdentifier for the Horizons service.horizons_stepsizeTime between ephemerides queried from the Horizons service5 minutesmax_magnitudeMaximum magnitudemin_magnitudeMinimum magnitude for the target.modeObservation mode, such as imaging or longslit.mos_mask_rsmtBinary stream containing an RSMT MOS mask definition file.output_formatOutput format of the generated finder charts, such as PDF.OutputFormat.PDFposition_anglePosition angle.Generally 0° or, if appropriate, chosen to allow for easier acquisition.raRight ascension of the finder chart center, as an angle between 0 and 360 degrees.slitwidthSlit width, as an angle.start_timeStart time from which to generate finder charts. This is only relevant for non-sidereal targets.Start of the current Julian day. Must be timezone-aware.surveySurvey from which to get the finder chart image.Survey.POSS2UKSTU_REDtitleTitle of the finder chart.Which of these arguments are required depends on the combination of arguments used. Also, some arguments may be ignored when used with others. For example, the slit width won;t be used if the observing mode is imaging.While normally you wouldn't have to use it, thesalt_finder_chartspackage also offers afinder_chartsfunction which lets you customise some aspects of the finder chart generation.For example, you could create the same longslit observation finder charts as above with the following code.importastropy.unitsasufromsalt_finder_chartsimportfinder_chartsfromsalt_finder_charts.ephemeridesimportConstantEphemerisServicefromsalt_finder_charts.imageimportSurveyImageService,Surveyfromsalt_finder_charts.modeimportLongslitModeDetailsfromsalt_finder_charts.outputimportoutput_pdffromsalt_finder_charts.utilimportMagnitudeRangemagnitude_range=MagnitudeRange(bandpass="V",max_magnitude=18,min_magnitude=18)ephemeris_service=ConstantEphemerisService(ra=78.6568723*u.deg,dec=-27.63792*u.deg,magnitude_range=magnitude_range)image_service=SurveyImageService(Survey.POSS2UKSTU_RED)mode_details=LongslitModeDetails(slitwidth=2*u.arcsec,pa=0*u.deg)fcs=finder_charts(ephemeris_service=ephemeris_service,image_service=image_service,mode_details=mode_details,output=output_pdf,title="test Finding Chart")Like thestandard_finder_chartsfunction,finder_chartsreturns a generator of binary streams with the finder charts. It uses the following arguments.ArgumentDescriptionDefaultbasic_annotationsWhether to add basic annotations only.Falseend_timeEnd time until which to generate finder charts. This is only relevant for non-sidereal targets. Must be timezone-aware.End of the current Julian dayephemeris_serviceService for getting ephemerides.image_serviceService for getting finder chart images.mode_detailsObserving mode and its detailsoutputFunction for converting a finding chart into an output format such as pdf.start_timeStart time from which to generate finder charts. This is only relevant for non-sidereal targets.  Must be timezone-aware.Start of the current Julian day.titleTitle for the finder chart.Command-line interface for generating finder chartsFor convenience, a commandsaltfcis provided, which you can run in a terminal. It saves the generated finding charts in a directory. The filename of the generated files consists of a basename (such asFinderChart) followed by a dash and a running number. The basename can be customised with a command line option. Existing files are replaced without warning,For example, you can generate finder charts for an asteroid by running the following command in a terminal.saltfc\--output-dir/tmp\--basename"Asteroid_54827"\--modeimaging\--horizons-id54827\--start-time"2019-06-28 11:31:00"\--end-time"2019-06-29 12:31:00"\--output-formatPDFThe command line options forsaltfcare essentially the same as the arguments for thestandard_finder_chartsfunction, plus options for customising the file base name and setting the output directory.ArgumentDescriptionDefault--bandpassBandpass for the magnitudes, such as V.--basenameBasename for the saved finder chart filesFinderChart--basic_annotationsAdd basic annotations only.False--decDeclination of the finder chart center, as an angle between -90 and 90 degrees, in degrees.--end_timeEnd time until which to generate finder charts. This is only relevant for non-sidereal targets. The time is supposed to be in UTC.End of the current Julian day--horizons_idIdentifier for the Horizons service.--horizons_stepsizeMinutes between ephemerides queried from the Horizons service5--max_magnitudeMaximum magnitude for the target--min_magnitudeMinimum magnitude for the target.--modeObservation mode, such as imaging or longslit.--mos_mask_rsmtRSMT MOS mask file--output-dirDirectory where to store the generated finder chart files.--output_formatOutput format of the generated finder charts, such as PDF.PDF--position_anglePosition angle, in degrees.Generally 0 or, if appropriate, chosen to allow for easier acquisition.--raRight ascension of the finder chart center, as an angle between 0 and 360 degrees, in degrees.--slitwidthSlit width, as an angle in arcseconds.--start_timeStart time from which to generate finder charts. This is only relevant for non-sidereal targets.Start of the current Julian day. The time is supposed to be in UTC.--surveySurvey from which to get the finder chart image.Survey.POSS2UKSTU_RED--titleTitle of the finder chart.Both the start and end time use the formatyyyy-mm-dd hh:mm:ss. For example, valid values are2019-01-25 9:45:16'or2020-01-02 12:00:00.Command interface for calculating position anglesA suitable position angle for a target can be calculated with thepacommand. It tries to find a star in an annulus around the target with a magnitude in a given magnitude range. The stsr must have a given minimum separation from its neighbouring stars.The radii, magnitudes and minimum separation all have default values, and usually you should not have to specify them. Hence a typical call ofpalooks as follows./pa--ra217.524--dec-23.97611Here is a list of the available arguments forpa.ArgumentDescriptionDefault--decDeclination of the target, in degrees.--max-magMaximum (faintest) magnitude a suitable star may have.18--max-radiusMaximum radius, in arcminutes, of the annulus in which the suitable stars are located. "3--min-magMinimum (brightest) magnitude a suitable star may have.15--min-radiusMinimum radius of the annulus in which the suitable stars are located.1--min-separationMinimum angular distance, in arcseconds, a suitable star must have from its neighbouring stars.10