Author Topic: A new (small) bug?  (Read 6152 times)

Offline cfranks

  • PixInsight Addict
  • ***
  • Posts: 138
A new (small) bug?
« on: 2010 January 13 20:28:24 »
I can't find prior reference to this but DBE alters the name of my image.  My .fits file name begins with the TEC temperature. The one in question is -10 (negative 10).  Invoke DBE and it is changed to _10 (underscore 10). P.I. ver 1.5.09.0561 (X86). Windows XP Pro SP3.

Hope I'm not wasting anyones time. :(

Charles

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: A new (small) bug?
« Reply #1 on: 2010 January 13 20:30:34 »
For some reason PI does not like '-' in file IDs. Not sure why as they're allowed in filenames. Look at the file ID after you load your original TIFF, it'l be _10... instead of -10....
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline cfranks

  • PixInsight Addict
  • ***
  • Posts: 138
Re: A new (small) bug?
« Reply #2 on: 2010 January 13 20:33:40 »
Thanks Sander, I just found the same but you beat me back before I could change the post. Yes, it was changed after 'open'.

Charles

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: A new (small) bug?
« Reply #3 on: 2010 January 13 20:39:06 »
Hi Charles,

still it's a good point to raise. The only reason I can imagine that the ID can not contain '-' is that it has to match the \w+ regexp for some reason. It's not a huge issue but I think it's an odd restriction on an otherwise very flexible package.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: A new (small) bug?
« Reply #4 on: 2010 January 22 00:41:31 »
Oops! I overlooked this one.

Quote
For some reason PI does not like '-' in file IDs

These are not file IDs, but view identifiers in PixInsight. A view identifier must be an alphabetic or underscore character optionally followed by a sequence of underscore, alphabetic and decimal numeric characters of arbitrary length. Formally:

view-identifier:
   <id-starting-digit><id-end-sequence>opt

id-end-sequence:
   <id-middle-digit><id-end-sequence>opt

id-starting-digit: one of:
   <underscore>
   <alpha-digit>

id-middle-digit: one of:
   <id-starting-digit>
   <decimal-digit>

underscore:
   _

alpha-digit: one of:
   abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

decimal-digit: one of:
   0123456789

Note that this is just the common C syntax for symbol identifiers.

Quote
It's not a huge issue but I think it's an odd restriction on an otherwise very flexible package

It isn't a restriction, but a necessary syntax rule. View identifiers are variable names on the PixInsight platform. Consider for example a PixelMath expression. Obviously, a view identifier cannot contain a minus sign because it is an operator symbol. The same happens with variable names (symbols, in general) in most programming languages.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: A new (small) bug?
« Reply #5 on: 2010 January 22 05:43:52 »
Hi Juan,

A simple pixel math grammar change would be that operands with non-alpha characters need to be enclosed in quotes. Filenames with ' ' and '-' are quite common although personally I don't like spaces in my paths.

If there's a will there's a way. Syntax bows to desired behavior, not the other way around. The current behavior *is* restrictive and not strictly necessary. You can claim that it's a worthwhile tradeoff but ultimately the user decides that.

Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: A new (small) bug?
« Reply #6 on: 2010 January 22 07:21:54 »
Hi Sander,

I disagree here. What you see as a restriction is IMO a guarantee of future extensibility. Bear in mind that PixInsight is not actually an application. It is a software platform where three user interfaces coexist cooperatively: a GUI, a command-line interface, and a scripting interface. In addition, PixInsight is a development framework. This imposes an extra need for coherency.

Language grammars must be simple and coherent, along with capable of expressing powerful constructs with beauty and elegance. In the case of PixelMath --which is an essential part of PixInsight, as you know--, if the following PixelMath expression:

foo = "my-bar"

means "assign the current pixel of my-bar to variable foo", then it excludes the possibility of using literal strings in PixelMath. This is an improvement that I am implementing, which will be available in one of the upcoming new versions. For example:

a = Prompt( "Enter the coefficient value", 0, 1, 0.5 )

will open a dialog box with a label and a numeric field, then wait until the user enters a number between 0 and 1, with default value of 0.5. The dialog's result would be assigned to variable a in this case.

A solution to disambiguate image references would be a specialized function such as:

foo = ImageById( "my-bar" )

or even a macro-function such as:

foo = $IMGREF( my-bar )

but these are, IMO, unnecessary and inelegant. These constructs would spoil PixelMath syntax without adding new functionality, considering that image references are represented now in a completely natural way (as variables, which is what they are) thanks to strict view identifiers.

The problem isn't limited to PixelMath syntax. C-syntax view identifiers are necessary to guarantee future extensions of the scripting system where images will be handled as global variables. For example, PixelMath syntax can be extended to implement a more sophisticated scripting language with control structures. That language, specialized in pixel-by-pixel math, would be much more efficient than a dynamic language such as JavaScript (as happens now with PixelMath), and could be integrated with the GUI and the command-line, just as JavaScript scripts are integrated now. A loose identifier syntax is an obstacle to these and similar extensions.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/