Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 158 additions & 3 deletions Python/ades/packUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
programCodesArray = R"""0123456789!"#$%&'()*+,-./[\]^_`{|}~:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"""
validProgramCodes = ' ' + programCodesArray

# Updated 25-Apr-2024 based on https://www.minorplanetcenter.net/iau/lists/ProgramCodes.txt
# Updated 30-Apr-2026 based on MPC's obscodes table
programCodeSites = \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not enjoy that this list is hard-coded into here... Maybe in the near future, we should add the has_prog_code column of the obscodes table to the public replication, so that the obscodes API (https://docs.minorplanetcenter.net/mpc-ops-docs/apis/obscodes/#response-fields-json-format) could be used to figure out the most up to date list of obscodes that use program codes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like it either, but a decision was made early on, at the request of some observers, that the ADES tools should not rely on a network connection.

Maybe that is so 2015 and it should be revisited. In that case the validator could also check the MPC-maintained list for mode, notes, astCat, etc.

@Bill-Gray Bill-Gray May 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relying on a network connection remains iffy for those in remote locations. But it should be acceptable to require that you have files listing modes, notes, etc. present when you run the tools, and to point out that you'll have to update those files every now and then if you use the latest and greatest modes, notes, etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not a fan of the hard-coded lists. Perhaps a hybrid approach can be taken where the list of allowable values for program codes (and others) are stored in a data file that is distributed with this code. We can then populate the data file with the MPC APIs at build-time and release it along with the code in our PyPI versioned releases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked to Mike about this and we also had an internal discussion with Peter W about the possibility of changing the hard-coded list to something more API-driven. At the moment, Peter, even though not a fan of the hard-coded lists, would prefer to maintain the code as it is. We might want to revisit it in the future. Thank you all.

set([ "010",
"012",
Expand All @@ -70,109 +70,256 @@
"089",
"094",
"095",
"098",
"119",
"121",
"181",
"186",
"204",
"209",
"245",
"246",
"247",
"249",
"250",
"251",
"252",
"253",
"254",
"255",
"256",
"257",
"259",
"260",
"261",
"262",
"263",
"264",
"265",
"266",
"267",
"268",
"269",
"271",
"272",
"273",
"274",
"275",
"287",
"288",
"289",
"290",
"291",
"308",
"309",
"323",
"327",
"336",
"338",
"339",
"413",
"561",
"566",
"568",
"644",
"645",
"658",
"673",
"675",
"688",
"689",
"691",
"695",
"696",
"699",
"703",
"705",
"807",
"809",
"851",
"932",
"950",
"A84",
"B35",
"B63",
"C40",
"C49",
"C50",
"C51",
"C53",
"C57",
"C58",
"C65",
"D20",
"D90",
"E03",
"E10",
"E26",
"E41",
"E42",
"E54",
"E62",
"E84",
"F51",
"F52",
"F65",
"G34",
"G37",
"G40",
"G73",
"G83",
"G84",
"G96",
"H06",
"H45",
"I03",
"I05",
"I11",
"I18",
"I22",
"I33",
"I41",
"I52",
"I89",
"J04",
"J13",
"J26",
"J69",
"J75",
"J95",
"K91",
"K92",
"K93",
"K99",
"L09",
"L28",
"L34",
"L80",
"L81",
"M18",
"M22",
"M49",
"N50",
"N53",
"O58",
"P21",
"Q12",
"Q14",
"Q54",
"Q55",
"Q58",
"Q59",
"Q62",
"Q63",
"Q64",
"R16",
"R17",
"R44",
"R50",
"R51",
"R52",
"R53",
"R54",
"R55",
"R59",
"R60",
"R61",
"R62",
"R68",
"R70",
"R71",
"R72",
"R73",
"R74",
"R75",
"R76",
"R77",
"R85",
"R92",
"R93",
"R97",
"R99",
"S04",
"S16",
"S42",
"S43",
"S47",
"S61",
"S89",
"T03",
"T04",
"T05",
"T08",
"T09",
"T10",
"T11",
"T12",
"T13",
"T14",
"T15",
"T16",
"T17",
"U62",
"U65",
"U69",
"U92",
"U94",
"U95",
"V00",
"V06",
"V07",
"V26",
"V37",
"V38",
"V39",
"V45",
"V46",
"V47",
"V48",
"V55",
"V57",
"W11",
"W26",
"W27",
"W36",
"W37",
"W38",
"W57",
"W68",
"W74",
"W76",
"W79",
"W84",
"W85",
"W86",
"W87",
"W88",
"W89",
"W97",
"W98",
"X05",
"X06",
"X07",
"X11",
"X22",
"X23",
"X24",
"X25",
"X26",
"X27",
"Z17",
"Z18",
"Z19",
"Z20",
"Z21",
"Z23",
"Z24",
"Z28",
"Z31",
"Z33",
"Z58",
"Z84" ])

# For STEREO and SOHO there is a letter in col 14 to
# indicate which instrument is used. This is to be treated as a
# program code by adding these obscodes to programCodeSites.
Expand Down Expand Up @@ -240,7 +387,15 @@
'3': 'Gaia_Int',
'4': 'GZ',
'5': 'UBSC',
'6': 'Gaia_2016',
'6': 'Gaia_2016',
'7': 'ZZCAT',
'8': 'APASS',
'9': 'UBSC',
'!': 'AKARI',
'@': 'AG',
'#': 'WISE',
'$': 'LSST2502',
'^': 'IRASPSC'
}

rCatCodes = { catCodes[i]:i for i in catCodes }
Expand Down
Loading