[AstroPy] two columns with two character delimiter

Aldcroft, Thomas aldcroft at head.cfa.harvard.edu
Fri Aug 19 06:26:41 EDT 2022


I'm not aware of a way to output a table using Table.write with a delimiter
that is more than one character. This stems from the underlying Python
`csv` library which only supports one-character delimiters:
https://docs.python.org/3/library/csv.html#dialects-and-formatting-parameters

Best,
Tom


On Thu, Aug 18, 2022 at 9:52 PM Kathleen Labrie <kathleen.labrie at noirlab.edu>
wrote:

> Azalee,
>
> The wording in the instructions is confusing.  I checked with someone here
> at Gemini.
>
> "Two space-separated columns: (1) wavelength in nm and (2) flux density in
> arbitrary units"
>
> The meaning is 2 columns separated with a space (no restriction on the
> number of space "character"), not columns separated by exactly 2 spaces.
> :)   Someone is already on it to fix the wording.
>
> That being said, I'm still interested in the technical Python question.
>
> Kathleen
>
>
> On Thu, Aug 18, 2022 at 2:19 PM Azalee Bostroem <abostroem at gmail.com>
> wrote:
>
>> Hi,
>>
>> The Gemini ITC requires a user defined spectrum to have columns separated
>> by two spaces. Does anyone know how to write out an astropy table with this
>> format? I tried the following:
>>
>>    - format='ascii': this writes out columns separated by a space
>>    - delimiter='  ': this produces an error, delimiters are required to
>>    be one character
>>    - format='fixed_width', delimiter_pad=' ': the produces a variable
>>    number of spaces between columns since each number doesn’t have an
>>    identical number of digits
>>    - format='ascii', delimiter_pad=' ': this produces an error,
>>    delimiter_pad is only a keyword for fixed_width format
>>
>>
>> I know there are ways to do with outside of Table.write, but I’m curious
>> if there is a way to achieve this format with Table.write?
>>
>> Thanks,
>> Azalee
>>
>>
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at python.org
>> https://mail.python.org/mailman/listinfo/astropy
>>
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20220819/2a3b8a1f/attachment.html>


More information about the AstroPy mailing list