What is a valid view identifier?

danoid

Well-known member
Slightly frustrated here. I'm trying to rename an image and I just get told I'm not following the rules...

2020-06-27_SHO -> invalid
2020_06_27_SHO -> invalid
2020-06-27 SHO -> invalid
20200627SHO -> invalid
SHO-2020-06-27 -> invalid

'Image13' just doesn't work for me but I can't seem to rename to something that makes sense to me. What are the rules for view identifiers?

Various profanities (in English German and Spanish) work fine...
 
spaces are no good, dashes are no good. underscores are fine. there is a logic here, IIRC views have to be valid C++ variable identifiers. so basically [0-9], [A-Z] and [a-z] are legal, plus underscores. however, again IIRC a view name can not start with a number as that's against C++ variable rules as well.

rob
 
also note that when you open a file which would have an illegal PI view identifier, the offending characters are replaced by underscores, and filenames with leading numbers get an underscore prepended to them.
 
So it's user friendly then? (n)

I figured something like this was in play. Humans with keyboards prefer - to _. You don't have to hold down the extra shift key. And humans don't mind starting with numbers. It's not that much extra code to convert from a human friendly string to a machine friendly internal identifier. But it should have been done at the onset.

Thanks, at least I know now.
 
There are very good reasons why view identifiers must be valid C identifiers in PixInsight. One of the most visible ones is the fact that you can use a view identifier as a variable in PixelMath, which implements a C-like procedural language. Another, less visible reason is the fact that PixInsight implements a command-line interface integrated in its Process Console component, which uses a shell-like language. There are more and will be more reasons in future versions.

As for user friendliness, it has never been one of PixInsight's main design principles. Sophistication, versatility and efficiency are some of them. This restriction on view identifiers must not be interpreted as a limit imposed arbitrarily. On the contrary, it follows design criteria that have guided the development of PixInsight for more than 15 years. These restrictions should be seen as a guarantee for the generation of new complexity in the future.
 
C is itself an interpretation. I'd be willing to bet at some level 'Image13' translates to '01001001011011010110000101100111011001010011000100110011'.

At that level there is no difference between 'Image13' and '2020-06-27-SHO' or '0011001000110000001100100011000000101101001100000011011000101101001100100011011100101101010100110100100001001111'

Just a convenience to the programmer rather than the user.

Like I said, at least now I know the arbitrary rules.
 
Back
Top