Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formats code à la Visual Studio Code #69

Open
wants to merge 80 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3c5750a
Ignores .vscode directory
martinwiesmann Nov 12, 2024
e3f65fb
Autoformat min ana2fitshdr
martinwiesmann Nov 21, 2024
85647fb
Autoformat min rget
martinwiesmann Nov 21, 2024
2eb8a59
Autoformat min prits_tools
martinwiesmann Nov 21, 2024
9400c46
Autoformat min raster_browser
martinwiesmann Nov 21, 2024
d81be04
Autoformat min quicklook
martinwiesmann Nov 21, 2024
0ec6c97
Autoformat min tests
martinwiesmann Nov 21, 2024
998ae81
Autoformat min utils
martinwiesmann Nov 21, 2024
dc1688c
Autoformat min objects
martinwiesmann Nov 21, 2024
9d4c6de
Fixes warnings from VSC ext to spice_data__define.pro
martinwiesmann Nov 21, 2024
2469056
Fixes all errors and warnings from VSC ext to spice_create_l3_progres…
martinwiesmann Nov 13, 2024
40a9816
Fixes all errors and warnings from VSC ext to spice_data_l3__define.pro
martinwiesmann Nov 13, 2024
36b7181
Fixes typos
martinwiesmann Nov 21, 2024
efcd8fc
Create cds_ext_time__define.pro
martinwiesmann Nov 13, 2024
23be47b
Fixes tupo
martinwiesmann Nov 21, 2024
5073f83
Fixes warnings from VSC ext to ana2fitshdr.pro
martinwiesmann Nov 21, 2024
3b9149e
Fixes typo
martinwiesmann Nov 21, 2024
47d4935
Fixes warnings from VSC ext to ana2fitshdr_data
martinwiesmann Nov 21, 2024
7892bdf
Fixes warnings from VSC ext to ana2fitshdr_results
martinwiesmann Nov 21, 2024
6fb734a
Fixes warnings from VSC ext to fits2ana
martinwiesmann Nov 21, 2024
7a4b085
Fixes warnings from VSC ext to generate_adef
martinwiesmann Nov 21, 2024
82d12c8
Fixes warnings from VSC ext to oslo_fits_util_define
martinwiesmann Nov 21, 2024
6ec2158
Fixes warnings from VSC ext to date_addons
martinwiesmann Nov 21, 2024
0d3962f
Fixes warnings from VSC ext to prits_tools__define
martinwiesmann Nov 21, 2024
1f579d3
Fixes warnings from VSC ext to gen_addons
martinwiesmann Nov 21, 2024
27b3dad
Fixes warnings from VSC ext to parcheck
martinwiesmann Nov 21, 2024
a1538db
Fixes warnings from VSC ext to remove_trends
martinwiesmann Nov 21, 2024
d35f098
Fixes warnings from VSC ext to vso_addons
martinwiesmann Nov 21, 2024
fb6869a
Fixes warnings from VSC ext to write_image_real_size
martinwiesmann Nov 21, 2024
e6ef6a8
Fixes warnings from VSC ext to sdc_util
martinwiesmann Nov 21, 2024
4ee3a8e
Fixes warnings from VSC ext to shadow_check
martinwiesmann Nov 21, 2024
f0c2bc2
Fixes warnings from VSC ext to create_l3)images
martinwiesmann Nov 21, 2024
bfd97ae
Fixes one more warning for widget_positioner
martinwiesmann Nov 21, 2024
bc6c8de
Fixes warnings from VSC ext to spice_xfiles
martinwiesmann Nov 22, 2024
f1b95d4
Fixes warnings from VSC ext to spice_xdetector part 1
martinwiesmann Nov 22, 2024
85cbdee
Fixes warnings from VSC ext to spice_xdetector part 2
martinwiesmann Nov 25, 2024
e9c855f
Rename and move spice_get_object to objects/spice_object
martinwiesmann Nov 25, 2024
323a059
Uses new spice_object function instead of spice_data or spice_get_object
martinwiesmann Nov 25, 2024
d4183cb
Update README.md
martinwiesmann Nov 26, 2024
e8e624a
Fixes warnings from VSC ext to spice_xcontrol
martinwiesmann Nov 26, 2024
60bc480
Adds new line at end of file
martinwiesmann Nov 26, 2024
1905421
Fixes warnings from VSC ext to spice_test_progress
martinwiesmann Nov 26, 2024
6a8007c
Fixes warnings from VSC ext to rget_dprint__define
martinwiesmann Nov 26, 2024
7627911
Fixes warnings from VSC ext to spice_xcontrol_l23
martinwiesmann Nov 26, 2024
c5f19c6
Fixes warnings from VSC ext to spice_xmap part 1
martinwiesmann Nov 26, 2024
879f1c3
Replaces unused var with !NULL
martinwiesmann Nov 27, 2024
ddb0ce3
Fixes warnings from VSC ext to spice_xraster
martinwiesmann Nov 27, 2024
5fa1fc8
Fixes warnings from VSC ext to spice_xwhisker
martinwiesmann Nov 28, 2024
7dd6905
Fixes warnings from VSC ext to spice_raster_browser
martinwiesmann Nov 28, 2024
995fd4e
Fixes warnings from VSC ext to browser_base_event
martinwiesmann Nov 28, 2024
95513c9
Fixes warnings from VSC ext to browser_widget
martinwiesmann Nov 28, 2024
b7afc90
Fixes warnings from VSC ext to browser_update_spectr
martinwiesmann Nov 28, 2024
8d6a2fe
Fixes warnings from VSC ext to raster_browser files
martinwiesmann Nov 28, 2024
8754222
Fixes warnings from VSC ext to create_l3_widget
martinwiesmann Nov 28, 2024
8373d66
Fixes warnings from VSC ext to create_l3_jpeg_presentation
martinwiesmann Nov 29, 2024
c8b689c
Fixes warnings from VSC ext to spice_find_file
martinwiesmann Nov 29, 2024
44058b7
Fixes warnings from VSC ext to find_observations
martinwiesmann Nov 29, 2024
0c5f448
Fixes warnings from VSC ext to get_windata
martinwiesmann Nov 29, 2024
824b79b
Fixes warnings from VSC ext to ingest_reorder
martinwiesmann Nov 29, 2024
41359c2
Fixes warnings from VSC ext to ingest
martinwiesmann Nov 29, 2024
5de0c57
Fixes warnings from VSC ext to spice_read_cat
martinwiesmann Dec 5, 2024
cc1c95d
Fixes warnings from VSC ext to spice_plot_mask_auto_fit
martinwiesmann Dec 5, 2024
0405ddf
Fixes warnings from VSC ext to overwrite_l3
martinwiesmann Dec 5, 2024
453b8ac
Fixes warnings from VSC ext to mask_spectrum
martinwiesmann Dec 5, 2024
3d0f543
Fixes warnings from VSC ext to make_image
martinwiesmann Dec 5, 2024
5c6b72f
Fixes warnings from VSC ext to spice_mask_auto_fit
martinwiesmann Dec 5, 2024
e3dd7d5
Fixes warnings from VSC ext to spice_keyword_info
martinwiesmann Dec 5, 2024
4bd0298
Fixes warnings from VSC ext to spice_gen_cat
martinwiesmann Dec 5, 2024
ce24c7c
Fixes warnings from VSC ext to spice_cat part 1
martinwiesmann Dec 5, 2024
d81a367
Fixes bug introduced by Autoformat
martinwiesmann Dec 9, 2024
b081692
Changed all brackets to square brackets where necessary.
martinwiesmann Dec 10, 2024
71954de
Deletes old test files
martinwiesmann Dec 10, 2024
0303d3c
Delete spice_test_l3_driver.pro
martinwiesmann Dec 10, 2024
370b916
Deletes unused .gitignore
martinwiesmann Dec 10, 2024
adb26aa
Fixes warnings from VSC ext to spice_cat part 2
martinwiesmann Dec 10, 2024
9523f65
Fixes warnings from VSC ext to spice_cat part 3
martinwiesmann Dec 10, 2024
1927525
Destroys object again
martinwiesmann Dec 12, 2024
82aaa74
Returns also paths of existing l3 files
martinwiesmann Dec 13, 2024
cf3e8da
Update spice_create_l3_driver.pro
martinwiesmann Dec 17, 2024
e242458
Destroys created objects
martinwiesmann Dec 19, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.\#*
._.DS_Store
._*
.vscode
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ We defined a SPICE data object, called SPICE_DATA, which can be initiated with a
contains many methods to handle the data and the header contained in the given FITS file. It can be created
using one of these commands:
```
spice_object = spice_object(spice_file) ; flexible form, accepts also level 3 files
spice_object = spice_data(spice_file) ; short form
spice_object = obj_new('spice_data', spice_file) ; long form
```
Expand Down Expand Up @@ -204,7 +205,7 @@ There are several useful tools to manage SPICE files:
This repository includes a pre-commit git hook, that updates a specific line of each modified file with the current
date and time. The line with this format will be edited:
```
; $Id: 2024-02-09 14:12 CET $
; $Id: 2024-11-26 11:40 CET $
```
If the file you modified, does not contain this line yet, please add it, preferably append it to the procedure
description at the beginning of the file.
Expand Down
146 changes: 70 additions & 76 deletions objects/spice_create_l3_progress__define.pro
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
; PROCEDURE:
;
; RESTRICTIONS:
;
;
; EXAMPLE:
; pro create_l3_file, file, progress_widget
; progress_widget->next_file, n_windows, halt=halt
Expand All @@ -49,7 +49,7 @@
; ENDFOR
; ; write l3 file
; end
;
;
; pro create_many_l3_files
; progress_widget = spice_create_l3_progress(files=spice_l2_files)
; FOR ifile=0,N_ELEMENTS(spice_l2_files)-1 DO BEGIN
Expand All @@ -61,8 +61,7 @@
; HISTORY:
; 06-Dec-2022: Martin Wiesmann, UIO, ITA.
;-
; $Id: 2023-06-13 13:52 CEST $

; $Id: 2024-11-27 10:44 CET $

;+
; Description:
Expand All @@ -77,12 +76,12 @@
; OUTPUT:
; 1 (True) if initialization succeeded, 0 (False) otherwise.
;-
FUNCTION spice_create_l3_progress::init, n_files, files=files, group_leader=group_leader
FUNCTION spice_create_l3_progress::init, n_files, files = files, group_leader = group_leader
COMPILE_OPT IDL2

prits_tools.parcheck, files, 0, "files", 'string', [0, 1], /optional
n_files_in = N_ELEMENTS(files)
prits_tools.parcheck, n_files, 1, "n_files", 'INTEGERS', 0, MINVAL=1, optional=n_files_in
n_files_in = n_elements(files)
prits_tools.parcheck, n_files, 1, "n_files", 'INTEGERS', 0, MINVAL = 1, optional = n_files_in

IF n_files_in GT 0 THEN BEGIN
self.n_files = n_files_in
Expand All @@ -91,7 +90,7 @@ FUNCTION spice_create_l3_progress::init, n_files, files=files, group_leader=grou
self.n_files = n_files
self.files_given = 0
files = strarr(n_files)
for i=0,n_files-1 do files[i]=fns('File ######', i)
FOR i = 0, n_files - 1 DO files[i] = fns('File ######', i)
ENDELSE
self.files = ptr_new(files)
temp = strlen(strtrim(self.n_files, 2))
Expand All @@ -100,43 +99,41 @@ FUNCTION spice_create_l3_progress::init, n_files, files=files, group_leader=grou
self.i_file = -1
self.halt = 0

self.base = widget_base(/column, title='Progress of creation of SPICE level 3 files')
self.slider_total = widget_slider(self.base, xsize=400, minimum=0, maximum=100, $
title='Percent done over all files')
self.slider_file = widget_slider(self.base, xsize=400, minimum=0, maximum=100, $
title='Percent done within the current file')
self.base = widget_base(/column, title = 'Progress of creation of SPICE level 3 files')
self.slider_total = widget_slider(self.base, xsize = 400, minimum = 0, maximum = 100, $
title = 'Percent done over all files')
self.slider_file = widget_slider(self.base, xsize = 400, minimum = 0, maximum = 100, $
title = 'Percent done within the current file')

self.label_current_file_num = widget_label(self.base, value='File '+string(1, format=self.n_files_format)+ $
' of '+string(1, format=self.n_files_format))
self.label_current_path = cw_field(self.base, title='Current path ', /NoEdit, xsize=75)
self.label_current_file = cw_field(self.base, title='Current file ', /NoEdit, xsize=75)
label = widget_label(self.base, value=' ')
self.label_current_file_num = widget_label(self.base, value = 'File ' + string(1, format = self.n_files_format) + $
' of ' + string(1, format = self.n_files_format))
self.label_current_path = cw_field(self.base, title = 'Current path ', /noedit, xsize = 75)
self.label_current_file = cw_field(self.base, title = 'Current file ', /noedit, xsize = 75)
label = widget_label(self.base, value = ' ') ; idl-disable-line unused-var

self.label_current_window_num = widget_label(self.base, value='Window '+string(1, format=self.n_windows_format)+ $
' of '+string(1, format=self.n_windows_format))
self.label_current_window = cw_field(self.base, title='Current window', /NoEdit, xsize=75)
self.label_current_window_num = widget_label(self.base, value = 'Window ' + string(1, format = self.n_windows_format) + $
' of ' + string(1, format = self.n_windows_format))
self.label_current_window = cw_field(self.base, title = 'Current window', /NoEdit, xsize = 75)

self.list_files = widget_list(self.base, value=file_basename(files), /frame, xsize=75, scr_ysize=200)
self.stop_button = widget_button(self.base, value='Stop creation of level 3 files')
wp = widget_positioner(self.base, parent=group_leader)
wp->position, /left_align
self.list_files = widget_list(self.base, value = file_basename(files), /frame, xsize = 75, scr_ysize = 200)
self.stop_button = widget_button(self.base, value = 'Stop creation of level 3 files')
wp = widget_positioner(self.base, parent = group_leader)
wp.position, /left_align

return, 1
END


;+
; Description:
; This procedure is called if the object is destroyed, it frees all pointers and kills all widgets.
;-
pro spice_create_l3_progress::cleanup
PRO spice_create_l3_progress::cleanup
COMPILE_OPT IDL2

ptr_free, self.files
xkill, self.base
END


;+
; Description:
; This procedure sets the sliders and labels to the next file to be processed. The process first
Expand All @@ -153,14 +150,14 @@ END
; OUTPUT:
; halt: Will be set to 1 if user clicked on 'STOP' button.
;-
pro spice_create_l3_progress::next_file, n_windows, filename=filename, halt=halt
PRO spice_create_l3_progress::next_file, n_windows, filename = filename, halt = halt
COMPILE_OPT IDL2

prits_tools.parcheck, n_windows, 1, "n_windows", 'INTEGERS', 0, MINVAL=1
prits_tools.parcheck, n_windows, 1, "n_windows", 'INTEGERS', 0, MINVAL = 1
prits_tools.parcheck, filename, 0, "filename", 'string', 0, /optional

event = widget_event(self.stop_button, /nowait)
IF event.id NE 0L THEN BEGIN
IF event.id NE 0l THEN BEGIN
halt = 1
self.halt = 1
return
Expand All @@ -176,25 +173,24 @@ pro spice_create_l3_progress::next_file, n_windows, filename=filename, halt=halt

IF ~self.files_given && keyword_set(filename) THEN BEGIN
(*self.files)[self.i_file] = filename
widget_control, self.list_files, set_value=*self.files
widget_control, self.list_files, set_value = *self.files
ENDIF
self.filename = (*self.files)[self.i_file]

self.i_window = -1
self.window_name = fns('Window ##', 0)
self.n_windows = n_windows

widget_control, self.slider_total, set_value=float(self.i_file)/float(self.n_files)*100.0
widget_control, self.slider_file, set_value=0
widget_control, self.label_current_file_num, set_value='File '+string(self.i_file+1, format=self.n_files_format)+ $
' of '+string(self.n_files, format=self.n_files_format)
widget_control, self.label_current_path, set_value=file_dirname(self.filename)
widget_control, self.label_current_file, set_value=file_basename(self.filename)
widget_control, self.label_current_window_num, set_value='Window '+string(1, format=self.n_windows_format)+ $
' of '+string(self.n_windows, format=self.n_windows_format)
widget_control, self.label_current_window, set_value=self.window_name
end

widget_control, self.slider_total, set_value = float(self.i_file) / float(self.n_files) * 100.0
widget_control, self.slider_file, set_value = 0
widget_control, self.label_current_file_num, set_value = 'File ' + string(self.i_file + 1, format = self.n_files_format) + $
' of ' + string(self.n_files, format = self.n_files_format)
widget_control, self.label_current_path, set_value = file_dirname(self.filename)
widget_control, self.label_current_file, set_value = file_basename(self.filename)
widget_control, self.label_current_window_num, set_value = 'Window ' + string(1, format = self.n_windows_format) + $
' of ' + string(self.n_windows, format = self.n_windows_format)
widget_control, self.label_current_window, set_value = self.window_name
END

;+
; Description:
Expand All @@ -210,13 +206,13 @@ end
; OUTPUT:
; halt: Will be set to 1 if user clicked on 'STOP' button.
;-
pro spice_create_l3_progress::next_window, window_name=window_name, halt=halt
PRO spice_create_l3_progress::next_window, window_name = window_name, halt = halt
COMPILE_OPT IDL2

prits_tools.parcheck, window_name, 0, "window_name", 'string', 0, /optional

event = widget_event(self.stop_button, /nowait)
IF event.id NE 0L THEN BEGIN
IF event.id NE 0l THEN BEGIN
halt = 1
self.halt = 1
return
Expand All @@ -239,13 +235,12 @@ pro spice_create_l3_progress::next_window, window_name=window_name, halt=halt
percent_file = float(self.i_file) / float(self.n_files) * 100.0
percent_window = float(self.i_window) / float(self.n_windows)
percent_total = percent_file + 1.0 / float(self.n_files) * percent_window * 100.0
widget_control, self.slider_total, set_value=percent_total
widget_control, self.slider_file, set_value=percent_window*100.0
widget_control, self.label_current_window_num, set_value='Window '+string(self.i_window+1, format=self.n_windows_format)+ $
' of '+string(self.n_windows, format=self.n_windows_format)
widget_control, self.label_current_window, set_value=self.window_name
end

widget_control, self.slider_total, set_value = percent_total
widget_control, self.slider_file, set_value = percent_window * 100.0
widget_control, self.label_current_window_num, set_value = 'Window ' + string(self.i_window + 1, format = self.n_windows_format) + $
' of ' + string(self.n_windows, format = self.n_windows_format)
widget_control, self.label_current_window, set_value = self.window_name
END

;+
; Description:
Expand All @@ -259,35 +254,34 @@ FUNCTION spice_create_l3_progress::halted
return, self.halt
END


;+
; Description:
; Class definition procedure
;-
PRO spice_create_l3_progress__define
COMPILE_OPT IDL2

struct = {spice_create_l3_progress, $
n_files: 1, $ ; number of files to be processed
i_file: -1, $ ; index of current file beginning at zero
files: ptr_new(), $ ; list of files to be processed
files_given: 0b, $ ; indicates whether list of files was given at initialization
n_files_format: '', $ ; format in which to display number of files
filename: '', $ ; name of current file
n_windows: 1, $ ; number of windows in current file
i_window: -1, $ ; index of current window beginning at zero
window_name: '', $ ; name of current window
n_windows_format: '', $ ; format in which to display the number of windows
halt:0b, $ ; indicates whether the user clicked on the Stop button
base:0L, $
slider_total:0L, $
slider_file:0L, $
label_current_file_num:0L, $
label_current_path:0L, $
label_current_file:0L, $
label_current_window_num:0L, $
label_current_window:0L, $
list_files:0L, $
stop_button:0L $
}
!NULL = {spice_create_l3_progress, $
n_files: 1, $ ; number of files to be processed
i_file: -1, $ ; index of current file beginning at zero
files: ptr_new(), $ ; list of files to be processed
files_given: 0b, $ ; indicates whether list of files was given at initialization
n_files_format: '', $ ; format in which to display number of files
filename: '', $ ; name of current file
n_windows: 1, $ ; number of windows in current file
i_window: -1, $ ; index of current window beginning at zero
window_name: '', $ ; name of current window
n_windows_format: '', $ ; format in which to display the number of windows
halt: 0b, $ ; indicates whether the user clicked on the Stop button
base: 0l, $
slider_total: 0l, $
slider_file: 0l, $
label_current_file_num: 0l, $
label_current_path: 0l, $
label_current_file: 0l, $
label_current_window_num: 0l, $
label_current_window: 0l, $
list_files: 0l, $
stop_button: 0l $
}
END
66 changes: 0 additions & 66 deletions objects/spice_data.pro

This file was deleted.

Loading