RMS icon indicating copy to clipboard operation
RMS copied to clipboard

Make starting SkyFit2 easier

Open g7gpr opened this issue 6 months ago • 17 comments

In https://globalmeteornetwork.groups.io/g/coordinators/message/543 it is identified that some operators have trouble starting SkyFit2.

At present, if SkyFit2 is started without any parameters, it returns an error.

(vRMS) user@machine:~/source/RMS$ python -m Utils.SkyFit2
usage: SkyFit2.py [-h] [-c CONFIG_PATH] [-r] [-t TIME] [-f FPS] [-g CAMERA_GAMMA] [-p GEO_POINTS_PATH] [-n] [--peribg] [--flipud] [-m MASK_PATH] [--flatbiassub] INPUT_PATH
SkyFit2.py: error: the following arguments are required: INPUT_PATH

I suggest that SkyFit2 could load ~/source/RMS/.config, determine the path to the latest captured directory, and start working in that directory, as this is most often the task that people want to achieve.

g7gpr avatar Aug 01 '25 09:08 g7gpr

That's a great idea, but there should be a popup window to confirm this. Otherwise, someone might miss adding the path they want and think they opened that path.

dvida avatar Aug 01 '25 14:08 dvida

Another suggestion while youre "in there" - if ther's only one platepar in the folder that the user has provided, could skyfit automatically open it? There's probably no need to pop up a dialog when there's only one file present, and its unlikely one would want to open a platepar from a different folder to the FF files? I could be wrong about that but it feels a possibly useful addition.

markmac99 avatar Aug 01 '25 19:08 markmac99

Regarding the original proposal, i think this is assuming that one is running SkyFit2 on the Pi.

In a multicam setup, selecting the default config file would be incorrect, and there would be no target folder. How would we handle that? A nice addition would be to prompt the user to pick a camera from ~/source/Stations maybe?

Also, i run SkyFit2 on my Windows desktop as its much faster there. and the code is not installed in ~/source/RMS (in my case its actually in my cloud development workspace). The config file might exist in the folder above SkyFit2.py, though thats also not guaranteed. Worth considering how to handle these cases.

markmac99 avatar Aug 01 '25 19:08 markmac99

Another suggestion while youre "in there" - if ther's only one platepar in the folder that the user has provided, could skyfit automatically open it? There's probably no need to pop up a dialog when there's only one file present, and its unlikely one would want to open a platepar from a different folder to the FF files? I could be wrong about that but it feels a possibly useful addition.

It does this, and if CALSTARS is available it opens straight to the fits file with the most stars.

g7gpr avatar Aug 02 '25 00:08 g7gpr

Regarding the original proposal, i think this is assuming that one is running SkyFit2 on the Pi.

In a multicam setup, selecting the default config file would be incorrect, and there would be no target folder. How would we handle that? A nice addition would be to prompt the user to pick a camera from ~/source/Stations maybe?

Also, i run SkyFit2 on my Windows desktop as its much faster there. and the code is not installed in ~/source/RMS (in my case its actually in my cloud development workspace). The config file might exist in the folder above SkyFit2.py, though thats also not guaranteed. Worth considering how to handle these cases.

I'm really only thinking about Pi single camera operators in this pr. If there is no config file in source/RMS, or it can't find a CapturedFiles directory from there, then give the input dir not specified message.

I'll reflect on it, but it adds a lot more complexity. However if it does not get done now, reworking the code to do it in the future, could be even harder. Hmm.

g7gpr avatar Aug 02 '25 00:08 g7gpr

Ref the plate, whenever i run SkyFit2 i am prompted to select the plate file, though i'll check to see if i missed a recent change. Perhaps this is dependent on whether you're running it on the Pi. As noted i only ever run SkyFit on my desktop for performance reasons, and so i want to open the plate thats in the target folder. Ref the original change, on a multicam installation there's a default config file in the source/RMS folder which is not used and contains the dummy XX0001 ID so i guess in that situation it would hopefully ignore that file and display the message as at present. However, its not a big deal if the change only supports Pi, as long as the current default is the fallback .

markmac99 avatar Aug 02 '25 00:08 markmac99

Ref the plate, whenever i run SkyFit2 i am prompted to select the plate file, though i'll check to see if i missed a recent change. Perhaps this is dependent on whether you're running it on the Pi. As noted i only ever run SkyFit on my desktop for performance reasons, and so i want to open the plate thats in the target folder. Ref the original change, on a multicam installation there's a default config file in the source/RMS folder which is not used and contains the dummy XX0001 ID so i guess in that situation it would hopefully ignore that file and display the message as at present. However, its not a big deal if the change only supports Pi, as long as the current default is the fallback .

My proposed changes bypass the load platepar dialog.

A lot of the code to do this was already there, like someone planned the feature, but never finished it.

g7gpr avatar Aug 02 '25 01:08 g7gpr

Sounds good. So i guess the logic should be:

  • if there's a platepar in the target folder, use that
  • otherwise check ~/source/Stations/XXnnnn/ for a platepar
  • then check ~/source/RMS
  • finally, popup the dialog if no plate found This could be inserted into loadPlatepar.

By the way there's a flaw in the current logic to automatically open the platepar if present. This checks for the existence of a platepar in the target folder and sets initial_file, but then checks a different variable platepar_file which is initially empty so the dialog is produced. I think the logic here should be as shown below. I tested this on single-station Pi, multicam linux and Windows.

        if self.config.platepar_name in os.listdir(self.dir_path) and and update is False:
            initial_file = os.path.join(self.dir_path, self.config.platepar_name)
            platepar_file = initial_file
        else:
            initial_file = self.dir_path

Additional elifs can be added to check the other possible locations for the platepar, which would provide support for multicam and single-station.

markmac99 avatar Aug 02 '25 09:08 markmac99

That's the bit of code I was referring to, when it I said it looked as though someone had started that feature, but never quite finished it.

g7gpr avatar Aug 02 '25 11:08 g7gpr

Improved dialog box.

Image

https://1drv.ms/v/c/afaf45788769b751/EQjhVAZHGl1NpqnpqDPXd5QBTTpgpj3hA3ehuNdqmIpx1A?e=jo94JP

g7gpr avatar Aug 03 '25 09:08 g7gpr

I've implemented this in PR #667.

g7gpr avatar Aug 03 '25 11:08 g7gpr

Great work, can you just make a check that the station ID in the config file and the platepar match? For example, when I use a local installation of SkyFit to make a new plate, I want to get a new platepar dialog instead of loading the default one in ~/source/RMS.

dvida avatar Aug 18 '25 20:08 dvida

OK - will do.

g7gpr avatar Aug 19 '25 01:08 g7gpr

There's a few edge cases in that, the flow will need some thought.

g7gpr avatar Aug 19 '25 01:08 g7gpr

I suggest that the best logic would be

  • Look for a platepar in the folder containing the FF files, and then in the folder containing the config file.
  • By 'config file' i mean the one supplied via the -c parameter, or if thats absent, the one in the RMS home folder
  • If the plate's stationID matches the FF files and the config file, use it
  • Otherwise warn the user and ask them to select the correct platepar or create a new one

I think this should handle the cases where we're creating a new plate for a camera ?

markmac99 avatar Aug 19 '25 15:08 markmac99

That's a great summary. Let's implement this and see how it goes. In at least 50% of cases we'll be using SkyFit to make new plates so we need to make sure to make that as easy as possible.

dvida avatar Aug 19 '25 15:08 dvida

Looks good. I'll work on that.

g7gpr avatar Aug 19 '25 16:08 g7gpr