-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path11-creating-packages.jl
3758 lines (3056 loc) · 130 KB
/
11-creating-packages.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
### A Pluto.jl notebook ###
# v0.20.4
using Markdown
using InteractiveUtils
# ╔═╡ cfebe185-8871-4fe5-ac55-20c7803a0457
using PlutoUI; TableOfContents()
# ╔═╡ 2b2adba9-fc0d-4f59-95a5-8d14d1c067f4
md"""
In this section, we will discuss Julia modules, environments, and packages. This may be confusing at first, since in Python all three are combined into a single concept.
"""
# ╔═╡ 35e08843-8dde-495c-ab4f-bbb43ed75395
md"""
# Julia Modules
A module in Julia is a way to group a set of variables, types, and functions into a namespace. We've already used lots of modules in this workshop.
A module is created using a `module` block like this one:
```julia
module MyModA
y = 1
f(x) = 2x^2
end
```
Try making a small module with a couple of variables and functions in the next Pluto cell:
"""
# ╔═╡ 49bac5a6-51ee-4150-bb4f-3934bd8e4fb2
# ╔═╡ 56a7b4fe-970b-480a-bfaa-f703a17ade8c
md"""
The contents of modules can be accessed using a `.` (dot):
```julia
MyModA.f(2)
```
Try running the function you defined inside your module:
"""
# ╔═╡ 45695b6c-4f80-4eb7-8292-daf946ae494a
# ╔═╡ 3c3f1920-1c73-4744-a88c-9510e6bf4299
md"""
Any function, variable, or type defined in a module is distinct from those defined outside it.
For example, these two refer to completely different functions called `f`:
```julia
f(x) = 9x^3
module MyModA
f(x) = 2x
end
f(2) != MyModA.f(x)
```
This is separate from the concept of *methods*. Here` f` and `MyModA.f` are two different functions that have different meanings. Two methods of the same function are different *implementations* of the same meaning.
"""
# ╔═╡ 853c7f60-8445-4e5b-aa52-7560203b3a08
md"""
That said, it's common to extend a function from one module from another to add a new method. Let's see how that might work.
Imagine Alice creates a module called Geometry that defines a Point2D type.
It also contains a function `distance_from_origin`.
It has one method that accepts a single `Point2D` argument.
"""
# ╔═╡ 6303b5b5-63c8-4389-a0ae-2883c97840f7
module Geometry
struct Point2D
x::Float64
y::Float64
end
"""
Compute the distance between a point and the origin.
"""
function distance_from_origin end
function distance_from_origin(point::Point2D)
return sqrt(point.x^2 + point.y^2)
end
end
# ╔═╡ 075f999a-d2c6-4ef3-a776-ac1c81f1f1a0
module BobsGeometryExtras
using ..Geometry # .. only needed in Pluto since these are both submodules of Main
struct Point3D
x::Float64
y::Float64
z::Float64
end
function Geometry.distance_from_origin(point::Point3D)
return sqrt(point.x^2 + point.y^2 + point.x^2)
end
end
# ╔═╡ bd33ebc5-f4cc-4cf5-b8ba-3d4bf280749e
md"""
Try creating a `Point2D` and using the distance function:
"""
# ╔═╡ 0177630e-be79-4a84-bc7f-2c44bf260052
# ╔═╡ 1fd083b6-3a6d-4b96-8bbb-c4a2a108bff8
# ╔═╡ 96db8904-78e2-4caa-8e65-d01501df9b15
md"""
Now imagine that Bob wants to use Alice's package, and extend it to work with three dimensional points. Bob defines a new `Point3D` type and extends the `Geometry.distance_from_origin` function with a new method:
"""
# ╔═╡ c184cecc-cdad-4df1-a8b8-12e9cfdde48e
md"""
!!! note
The syntax `Module.function` should be used when adding a method to a function from another module.
"""
# ╔═╡ c7ccc1ff-9784-4cb1-a2cf-89a21d2c4ec3
md"""
Try using the `distance_from_origin` function with a `Point3D`:
"""
# ╔═╡ 307b6e57-28a2-4b0f-a512-76985925bc17
# ╔═╡ ef7c4547-552c-4487-91d8-4152cd60beb2
# ╔═╡ 47213373-9623-4edd-bfa8-9db62ff2eaba
md"""
Finally, let's take a look at how we can add methods to Julia's built in functions.
Add the following to the `BobsGeometryExtras` module from earlier:
```julia
using LinearAlgebra
function Base.abs(point::Point3D)
return Point3D(abs(point.x), abs(point.y), abs(point.z))
end
function Base.:(+)(a::Point3D, b::Point3D)
return Point3D(a.x + b.x, a.y + b.y, a.z + b.z)
end
# Define Point3D multiplication as the cross product
function Base.:(*)(a::Point3D, b::Point3D)
return Point3D(
a.z*b.z - a.z*b.y,
a.z*b.x - a.x*b.z,
a.x*b.y - a.y*b.x
)
end
```
Once you've done that, try the following examples:
```julia
p1 = BobsGeometryExtras.Point3D(1,1,1)
p2 = BobsGeometryExtras.Point3D(1,-1,1)
p3 = p1 + p2
p4 = p1 * p2
```
"""
# ╔═╡ 736dce7f-cc86-4dd8-ab5a-e05410689f7f
# ╔═╡ 93d3f0fc-030e-4600-8773-a68631dd5207
md"""
Since we've defined the `+` function on the Point2D type, lots of new behaviour emerges naturally.
1. Try creating a vector of points, and passing it to the `sum` function
2. Create two matrices of points, take the matrix multiplication of them with `*`
"""
# ╔═╡ dafceedf-5825-44a6-87f6-bb48e443ccb2
# ╔═╡ b4209638-ad3a-48ef-8323-883aaaf10a50
# ╔═╡ 4edef180-aa31-4e27-be61-e9d3a1d7b4a1
# ╔═╡ 8d877a0b-4a47-410f-818c-4a2e24ba4727
# ╔═╡ aac4a5ac-6492-4af5-898b-0e7e9eec2be0
# ╔═╡ 454ff2f3-fbe0-4125-a435-ef44b175c35d
md"""
!!! danger "Type Piracy"
**Type Piracy** is when you extend a function without at least one argument type that your module "owns". For example, it would be type piracy for Bob to extend Alice's `distance_from_origin` function with a method that takes two integers.
Though not enforced at the language level, type piracy must be avoided to prevent spooky action at a distance, where loading one module changes the behaviour of unrelated functionality in a separate module.
"""
# ╔═╡ d507c992-7b68-4af0-98c4-dacca3609273
md"""
Adding methods to existing functions is the main way that Julia packages are built, and a key component of Julia's uniquely pervasive composability.
A great talk on this topic is [The Unreasonable Effectiveness of Multiple Dispatch](https://www.youtube.com/watch?v=kc9HwsxE1OY) by Stefan Karpinski.
"""
# ╔═╡ 077135e0-8322-11ed-32aa-0724ce8da92c
md"""
# Julia Environments and Packages
Putting your code into a package is especially important in Julia, since it unlocks a few useful features:
* Re-using code
* Saving your compiled code for faster loading
* Live-reloading of code changes with Revise.jl
* Sharing your code with others
Notice that I put sharing your code at the bottom of the list. Placing your code in a package is a useful thing to do even if you're not sure you want to share your code with other people.
!!! note
A commercial but free service for finding Julia packages is [juliahub.com](https://juliahub.com/ui/Packages), operated by Julia Computing.
Before we talk about building a packge, let's discuss "environments".
"""
# ╔═╡ 9739ac67-b5ff-4488-9c7d-bbc4b3c36d3a
md"""
## Environments
An "environment" is a list of packages and possibly version numbers.
An environment consists of just two files:
* `Project.toml`
* `Manifest.toml`
`Project.toml` tracks what packages need to be installed to use that environment. It might look something like this:
```toml
[deps]
FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
```
Or
```toml
[deps]
FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[compat]
FITSIO = "0.17.0"
```
The keys on the left are the names of the packages, and the gobbledegook on the right is a unique machine readable identifier. This makes sure that even if people pick the same names for their packages, Julia won't get them confused.
!!! note
If you're planning on writing some scripts for a project, it's a very good idea to create an environment.
You don't have to make Project.toml yourself. Just open the julia REPL, navigate to the folder you're working out of, and type `] activate .` to activate the current folder as an environment.
Then, you can install packages as usual (`] add FITSIO`, for example) and Julia will modify `Project.toml`.
If you share your `Project.toml` with someone, they can activate it and run `instantiate` to install all of the packages inside. It will pick versions that match the general constraints listed under `[compat]`
---
`Manifest.toml` is a bit more niche. It stores all the exact versions of every package you use. If you want someone (possibly yourself at a later date) to be able to exactly reproduce an environment down to every detail, send them the `Manifest.toml` as well. This is a great way of ensuring reproducible science.
"""
# ╔═╡ 63d8bf16-f065-48dc-9e17-a92937414cd9
md"""
## Pluto (aside)
Pluto notebooks are stored in `.jl` files just like regular scripts. If you open one up in a text editor of your choice, you will see contents like the following:
```julia
### A Pluto.jl notebook ###
# v0.19.12
using Markdown
using InteractiveUtils
# e28bad2f-f4ea-4c30-9f08-746ca2f609d8
using AstroImages
# 98d2310d-a17b-4b0d-877d-9f77020848d3
using Plots
# 1877c9ea-77e9-11ed-11b3-4d295a402999
md"this is a markdown cell"
# 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = \"""
[deps]
AstroImages = "fe3fc30c-9b16-11e9-1c73-17dabf39f4ad"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
[compat]
AstroImages = "~0.4.0"
Plots = "~1.37.2"
\"""
# 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = \"""
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.0-DEV"
manifest_format = "2.0"
project_hash = "59562c7a7aee2e03c8392b93c96735eb9485add4"
# Cell order:
# ╠═20b9ba30-2685-4535-9244-693f8e653a9a
# ╠═67371af8-bd8d-4fef-b46a-6f57624e052d
# ╠═1877c9ea-77e9-11ed-11b3-4d295a402999
```
That is, a Pluto notebook is just a regular Julia script with some special formatting.
Two variables are defined `PLUTO_PROJECT_TOML_CONTENTS` and `PLUTO_MANIFEST_TOML_CONTENTS` that bundle in the Project.toml and Manifest.toml.
Basically, Pluto creates an environment for each notebook. If you open the notebook on another computer, Pluto will load the exact same versions of all packages.
"""
# ╔═╡ 1413a21a-d653-489d-80e6-9348b114fcff
md"""
## Packages
To make a Julia package, we create a simple file and folder structure. In other languages, a package might be called a "library".
To make a package called `MyPackage`, we'll create the following files:
```
MyPackage/
├─ src/
│ ├─ MyPackage.jl
├─ Project.toml
├─ Manifest.toml <this will be generated automatically by Julia>
```
Inside Project.toml we'll give the package a name and unique identifier. You can generate the identifier by running:
```julia
using UUIDs
uuid4()
```
Try it now:
"""
# ╔═╡ 9d08cba7-90e1-4fe0-842b-757d3df36a32
# ╔═╡ a413ec8f-0787-4d77-a04c-acffdf305b7a
# ╔═╡ 9238dcf9-3722-45a1-ad4b-af2a39d24626
md"""
`Project.toml` should look like
```toml
name = "MyPackage"
uuid = "<insert unique id here>"
```
Inside `MyPackage.jl` we'll create an empty module
```julia
module MyPackage
# code goes here!
end
```
That's it! You can now load your package by typing `] activate MyPackage` and then `using MyPackage`.
If you want your package accessible to other code, activate your other environment and, from inside, run `] develop /home/path-to/MyPackage`. This will add it to that environment's Project.toml.
"""
# ╔═╡ e120cf73-9eb2-4618-aa7f-215c6d9ccbbf
md"""
------
"""
# ╔═╡ 42ca97fc-57dc-4f24-9919-8d6a823ae151
md"""
Notice how we had to put `module MyPackage` at the top of MyPackage.jl? Unlike in Python, modules != files. You can create multiple, nested modules inside the same file (you should rarely want to do this):
```julia
module MyPackage
module PartA
end
module PartB
end
end
```
Or split a module across multiple files (you should often do this):
```julia
module MyPackge
include("type-definitions.jl")
include("function-definitions.jl")
end
```
`include` almost-literally copies and pastes in code from another file. It's the main way to split a package up into different unique units. Nested modules, like the first example, are almost never used in Julia.
!!! note
You can also use `include("file.jl")` to directly run a script from inside Julia.
"""
# ╔═╡ 44b4a9f9-7740-4ea5-bb03-3fca9a48f220
md"""
### Workflows for Developing Packages
The best way to work on a package is with Revise.jl. Revise is a simple package, just run `using Revise` at the start of your session, and Julia will automatically notice and recompile any code that changes in your package.
This way you can edit your package as you go, adding functions, fixing bugs, etc, and whenever you run anything in the REPL, you'll see the latest changes.
"""
# ╔═╡ 7dbb9c09-5b7a-4a5a-b6b1-8946b0cf962e
md"""
### Sharing Packages
The easiest way to share a Julia package is to put it on GitHub.
* Create a repository with same name as your package (include the `.jl`) and push your folder to it.
* Other people can install your package by running `] add https://github.com/yourname/MyPackage.jl.git`
Once you're happy with your package, you can "register" it with the Julia General Registry so that people can install it by just typing `] add MyPackage`.
There are lots more things you can add to your package over time.
"""
# ╔═╡ ea74763f-ece3-4a4c-ae76-39d1ac5ca2dd
md"""
### Tests
You can add tests in a file called `tests/runtests.jl`. Then, you can run `] test MyPackage` to get a test report.
If your package is registered, the Julia developers will run your package tests against new versions of Julia to make sure everything works as expected.
You can even hook up these tests to GitHub so that they run everytime you change the code. This is a great way to make sure everything stays working the way it should!
"""
# ╔═╡ cf62edf6-59e7-4880-9c51-897c29c1233c
md"""
### Documentation
You can add documentation to your package in the `docs` folder.
Read about how here: [documenter.juliadocs.org](https://documenter.juliadocs.org/stable/). You can set GitHub up to automatically convert your docs into a hosted webpage.
"""
# ╔═╡ 575703f0-efec-4092-b067-8eaf5600bd69
md"""
## Excercises
In these excercises, we will create our own package. This can be just a simple "hello world" function, but I would suggest you try creating a very basic package that you would use in your research.
### Part 1
* Come up with a name for your package.
* Create a folder structure with the right names.
* Using a text editor of your choiceCreate Project.toml with the package name and a unique identifier
### Part 2
* Fill out your package with a function or two. Try to come up with a function that would be useful to other people working in your sub-field.
* If you need to use a function defined in another Julia package, use `] add OtherPackage` to install and add it to `Project.toml` automatically.
### Part 3
* Share it with the group!
"""
# ╔═╡ 7b6689b3-75d3-4245-87ef-b46d93249414
md"""
## Bonus content: Defining functions with a for loop.
A neat trick that is widely used when writing modules is to use a for loop to write functions for you.
One common situtation where this is useful is when writing a package is that you define a type that combines an existing type like an array with some additional fields and behaviour. For example, `AstroImage` combines an a matrix with a header structure to track metadata.
In these situations, one typically wants the new type to behave just like the object it wraps (the matrix in this example) in several ways, but not in others.
Let's see how this may look.
"""
# ╔═╡ c16ec715-7adc-4fde-9021-8b44746ae6ff
struct MetaArray{TArray,TMetadata}
array::TArray
meta::TMetadata
end
# ╔═╡ 0a174016-3511-477b-ae12-d7978c20f45f
arr = MetaArray(randn(4,4), (a=1,b=2,c="text"))
# ╔═╡ feb49ac1-989c-4652-8e71-6d1f0d88199e
arr.meta.c
# ╔═╡ 147e7d41-5a58-4831-b449-66084a9210bb
for f in [
:(Base.getindex),
:(Base.setindex!),
:(Base.adjoint),
:(Base.transpose),
:(Base.view),
]
@eval ($f)(arr::MetaArray, args...) = MetaArray($f(arr.array, args...), arr.meta)
end
# ╔═╡ 8df360a9-df72-4da8-82a4-7f09b347c7cb
md"""
This is an example of *metaprogramming*: a program that writes a program.
We loop over the variable names Base.getindex, Base.setindex!, etc.
Inside the loop body, we create a quoted expression where some function \$f is defined against a MetaArray.
Then, we evaluate that expression, replacing \$f with the function in question.
"""
# ╔═╡ f7cb6ead-8799-47f9-a553-d570581e4b56
# Now we can use [] to get elements
arr[1,2]
# ╔═╡ fdece0ec-966a-4d33-82dc-3f6fe095075c
# We can transpose it
arr'
# ╔═╡ 365f7190-0737-46ba-accb-8d237e75a460
# We can create views into it
# ╔═╡ 6477fbb2-f266-44ee-b0b9-5464a53d88cf
v = view(arr, 1:2, 1:2)
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
AstroImages = "fe3fc30c-9b16-11e9-1c73-17dabf39f4ad"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
FLoops = "cc61a311-1640-44b5-9fba-1b764f453329"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
SpectralFitting = "f2c56810-742e-4b72-8bf4-27af3bb81a12"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAstro = "6112ee07-acf9-5e0f-b108-d242c714bf9f"
XSPECModels = "e051c099-9e89-4e1f-aad2-39a4611ecf4d"
[compat]
AstroImages = "~0.5.0"
BenchmarkTools = "~1.5.0"
CSV = "~0.10.15"
CairoMakie = "~0.12.18"
CategoricalArrays = "~0.10.8"
DataFrames = "~1.7.0"
FLoops = "~0.2.2"
LoopVectorization = "~0.12.171"
Measurements = "~2.11.0"
PhysicalConstants = "~0.2.3"
Plots = "~1.40.9"
PlutoUI = "~0.7.60"
PyCall = "~1.96.4"
PythonCall = "~0.9.23"
SpectralFitting = "~0.6.2"
Statistics = "~1.11.1"
Unitful = "~1.21.1"
UnitfulAstro = "~1.2.1"
XSPECModels = "~0.1.1"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.11.2"
manifest_format = "2.0"
project_hash = "af3015e2d209d37bdc4763dd0614d774e1fc80b5"
[[deps.ADTypes]]
git-tree-sha1 = "72af59f5b8f09faee36b4ec48e014a79210f2f4f"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "1.11.0"
[deps.ADTypes.extensions]
ADTypesChainRulesCoreExt = "ChainRulesCore"
ADTypesConstructionBaseExt = "ConstructionBase"
ADTypesEnzymeCoreExt = "EnzymeCore"
[deps.ADTypes.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "d92ad398961a3ed262d8bf04a1a2b8340f915fef"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "1.5.0"
weakdeps = ["ChainRulesCore", "Test"]
[deps.AbstractFFTs.extensions]
AbstractFFTsChainRulesCoreExt = "ChainRulesCore"
AbstractFFTsTestExt = "Test"
[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
git-tree-sha1 = "6e1d2a35f2f90a4bc7c2ed98079b2ba09c35b83a"
uuid = "6e696c72-6542-2067-7265-42206c756150"
version = "1.3.2"
[[deps.AbstractTrees]]
git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177"
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
version = "0.4.5"
[[deps.Accessors]]
deps = ["CompositionsBase", "ConstructionBase", "InverseFunctions", "LinearAlgebra", "MacroTools", "Markdown"]
git-tree-sha1 = "96bed9b1b57cf750cca50c311a197e306816a1cc"
uuid = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
version = "0.1.39"
[deps.Accessors.extensions]
AccessorsAxisKeysExt = "AxisKeys"
AccessorsDatesExt = "Dates"
AccessorsIntervalSetsExt = "IntervalSets"
AccessorsStaticArraysExt = "StaticArrays"
AccessorsStructArraysExt = "StructArrays"
AccessorsTestExt = "Test"
AccessorsUnitfulExt = "Unitful"
[deps.Accessors.weakdeps]
AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[[deps.Adapt]]
deps = ["LinearAlgebra", "Requires"]
git-tree-sha1 = "50c3c56a52972d78e8be9fd135bfb91c9574c140"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "4.1.1"
weakdeps = ["StaticArrays"]
[deps.Adapt.extensions]
AdaptStaticArraysExt = "StaticArrays"
[[deps.AdaptivePredicates]]
git-tree-sha1 = "7e651ea8d262d2d74ce75fdf47c4d63c07dba7a6"
uuid = "35492f91-a3bd-45ad-95db-fcad7dcfedb7"
version = "1.2.0"
[[deps.AliasTables]]
deps = ["PtrArrays", "Random"]
git-tree-sha1 = "9876e1e164b144ca45e9e3198d0b689cadfed9ff"
uuid = "66dad0bd-aa9a-41b7-9441-69ab47430ed8"
version = "1.1.3"
[[deps.Animations]]
deps = ["Colors"]
git-tree-sha1 = "e092fa223bf66a3c41f9c022bd074d916dc303e7"
uuid = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
version = "0.4.2"
[[deps.ArgCheck]]
git-tree-sha1 = "680b3b8759bd4c54052ada14e52355ab69e07876"
uuid = "dce04be8-c92d-5529-be00-80e4d2c0e197"
version = "2.4.0"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.2"
[[deps.ArrayInterface]]
deps = ["Adapt", "LinearAlgebra"]
git-tree-sha1 = "017fcb757f8e921fb44ee063a7aafe5f89b86dd1"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "7.18.0"
[deps.ArrayInterface.extensions]
ArrayInterfaceBandedMatricesExt = "BandedMatrices"
ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices"
ArrayInterfaceCUDAExt = "CUDA"
ArrayInterfaceCUDSSExt = "CUDSS"
ArrayInterfaceChainRulesCoreExt = "ChainRulesCore"
ArrayInterfaceChainRulesExt = "ChainRules"
ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore"
ArrayInterfaceReverseDiffExt = "ReverseDiff"
ArrayInterfaceSparseArraysExt = "SparseArrays"
ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore"
ArrayInterfaceTrackerExt = "Tracker"
[deps.ArrayInterface.weakdeps]
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CUDSS = "45b445bb-4962-46a0-9369-b4df9d0f772e"
ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.11.0"
[[deps.AstroAngles]]
git-tree-sha1 = "0193aaf231612adfa04f1e4187d0370ced0682b4"
uuid = "5c4adb95-c1fc-4c53-b4ea-2a94080c53d2"
version = "0.1.4"
[[deps.AstroImages]]
deps = ["AbstractFFTs", "AstroAngles", "ColorSchemes", "DimensionalData", "FITSIO", "FileIO", "ImageAxes", "ImageBase", "ImageIO", "ImageShow", "MappedArrays", "PlotUtils", "PrecompileTools", "Printf", "RecipesBase", "Statistics", "Tables", "UUIDs", "WCS"]
git-tree-sha1 = "2973b639f56a9aa5563db8be100c8c9a166486af"
uuid = "fe3fc30c-9b16-11e9-1c73-17dabf39f4ad"
version = "0.5.0"
[[deps.Atomix]]
deps = ["UnsafeAtomics"]
git-tree-sha1 = "c3b238aa28c1bebd4b5ea4988bebf27e9a01b72b"
uuid = "a9b6321e-bd34-4604-b9c9-b65b8de01458"
version = "1.0.1"
[deps.Atomix.extensions]
AtomixCUDAExt = "CUDA"
AtomixMetalExt = "Metal"
AtomixoneAPIExt = "oneAPI"
[deps.Atomix.weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
oneAPI = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b"
[[deps.Automa]]
deps = ["PrecompileTools", "SIMD", "TranscodingStreams"]
git-tree-sha1 = "a8f503e8e1a5f583fbef15a8440c8c7e32185df2"
uuid = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
version = "1.1.0"
[[deps.AxisAlgorithms]]
deps = ["LinearAlgebra", "Random", "SparseArrays", "WoodburyMatrices"]
git-tree-sha1 = "01b8ccb13d68535d73d2b0c23e39bd23155fb712"
uuid = "13072b0f-2c55-5437-9ae7-d433b7a33950"
version = "1.1.0"
[[deps.AxisArrays]]
deps = ["Dates", "IntervalSets", "IterTools", "RangeArrays"]
git-tree-sha1 = "16351be62963a67ac4083f748fdb3cca58bfd52f"
uuid = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
version = "0.4.7"
[[deps.BangBang]]
deps = ["Accessors", "ConstructionBase", "InitialValues", "LinearAlgebra", "Requires"]
git-tree-sha1 = "e2144b631226d9eeab2d746ca8880b7ccff504ae"
uuid = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
version = "0.4.3"
[deps.BangBang.extensions]
BangBangChainRulesCoreExt = "ChainRulesCore"
BangBangDataFramesExt = "DataFrames"
BangBangStaticArraysExt = "StaticArrays"
BangBangStructArraysExt = "StructArrays"
BangBangTablesExt = "Tables"
BangBangTypedTablesExt = "TypedTables"
[deps.BangBang.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
version = "1.11.0"
[[deps.Baselet]]
git-tree-sha1 = "aebf55e6d7795e02ca500a689d326ac979aaf89e"
uuid = "9718e550-a3fa-408a-8086-8db961cd8217"
version = "0.1.1"
[[deps.BenchmarkTools]]
deps = ["JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"]
git-tree-sha1 = "f1dff6729bc61f4d49e140da1af55dcd1ac97b2f"
uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
version = "1.5.0"
[[deps.BitFlags]]
git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d"
uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
version = "0.1.9"
[[deps.BitTwiddlingConvenienceFunctions]]
deps = ["Static"]
git-tree-sha1 = "f21cfd4950cb9f0587d5067e69405ad2acd27b87"
uuid = "62783981-4cbd-42fc-bca8-16325de8dc4b"
version = "0.1.6"
[[deps.BufferedStreams]]
git-tree-sha1 = "6863c5b7fc997eadcabdbaf6c5f201dc30032643"
uuid = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d"
version = "1.2.2"
[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "35abeca13bc0425cff9e59e229d971f5231323bf"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+3"
[[deps.CEnum]]
git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc"
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
version = "0.5.0"
[[deps.CFITSIO]]
deps = ["CFITSIO_jll"]
git-tree-sha1 = "fc0abb338eb8d90bc186ccf0a47c90825952c950"
uuid = "3b1b4be9-1499-4b22-8d78-7db3344d1961"
version = "1.4.2"
[[deps.CFITSIO_jll]]
deps = ["Artifacts", "JLLWrappers", "LibCURL_jll", "Libdl", "Zlib_jll"]
git-tree-sha1 = "b90d32054fc88f97dd926022f554180e744e4d7d"
uuid = "b3e40c51-02ae-5482-8a39-3ace5868dcf4"
version = "4.4.0+0"
[[deps.CPUSummary]]
deps = ["CpuId", "IfElse", "PrecompileTools", "Static"]
git-tree-sha1 = "5a97e67919535d6841172016c9530fd69494e5ec"
uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
version = "0.2.6"
[[deps.CRC32c]]
uuid = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
version = "1.11.0"
[[deps.CRlibm_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "e329286945d0cfc04456972ea732551869af1cfc"
uuid = "4e9b3aee-d8a1-5a3d-ad8b-7d824db253f0"
version = "1.0.1+0"
[[deps.CSV]]
deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "PrecompileTools", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"]
git-tree-sha1 = "deddd8725e5e1cc49ee205a1964256043720a6c3"
uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
version = "0.10.15"
[[deps.Cairo]]
deps = ["Cairo_jll", "Colors", "Glib_jll", "Graphics", "Libdl", "Pango_jll"]
git-tree-sha1 = "71aa551c5c33f1a4415867fe06b7844faadb0ae9"
uuid = "159f3aea-2a34-519c-b102-8c37f9878175"
version = "1.1.1"
[[deps.CairoMakie]]
deps = ["CRC32c", "Cairo", "Cairo_jll", "Colors", "FileIO", "FreeType", "GeometryBasics", "LinearAlgebra", "Makie", "PrecompileTools"]
git-tree-sha1 = "0afa2b4ac444b9412130d68493941e1af462e26a"
uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
version = "0.12.18"
[[deps.Cairo_jll]]
deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "009060c9a6168704143100f36ab08f06c2af4642"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.18.2+1"
[[deps.Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "9cb23bbb1127eefb022b022481466c0f1127d430"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.2"
[[deps.CategoricalArrays]]
deps = ["DataAPI", "Future", "Missings", "Printf", "Requires", "Statistics", "Unicode"]
git-tree-sha1 = "1568b28f91293458345dabba6a5ea3f183250a61"
uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597"
version = "0.10.8"
weakdeps = ["JSON", "RecipesBase", "SentinelArrays", "StructTypes"]
[deps.CategoricalArrays.extensions]
CategoricalArraysJSONExt = "JSON"
CategoricalArraysRecipesBaseExt = "RecipesBase"
CategoricalArraysSentinelArraysExt = "SentinelArrays"
CategoricalArraysStructTypesExt = "StructTypes"
[[deps.ChainRules]]
deps = ["Adapt", "ChainRulesCore", "Compat", "Distributed", "GPUArraysCore", "IrrationalConstants", "LinearAlgebra", "Random", "RealDot", "SparseArrays", "SparseInverseSubset", "Statistics", "StructArrays", "SuiteSparse"]
git-tree-sha1 = "bcffdcaed50d3453673b852f3522404a94b50fad"
uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2"
version = "1.72.1"
[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra"]
git-tree-sha1 = "3e4b134270b372f2ed4d4d0e936aabaefc1802bc"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.25.0"
weakdeps = ["SparseArrays"]
[deps.ChainRulesCore.extensions]
ChainRulesCoreSparseArraysExt = "SparseArrays"
[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
git-tree-sha1 = "05ba0d07cd4fd8b7a39541e31a7b0254704ea581"
uuid = "fb6a15b2-703c-40df-9091-08a04967cfa9"
version = "0.1.13"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "bce6804e5e6044c6daab27bb533d1295e4a2e759"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.6"
[[deps.ColorBrewer]]
deps = ["Colors", "JSON", "Test"]
git-tree-sha1 = "61c5334f33d91e570e1d0c3eb5465835242582c4"
uuid = "a2cac450-b92f-5266-8821-25eda20663c8"
version = "0.4.0"
[[deps.ColorSchemes]]
deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"]
git-tree-sha1 = "c785dfb1b3bfddd1da557e861b919819b82bbe5b"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.27.1"
[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.11.5"
[[deps.ColorVectorSpace]]
deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"]
git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249"
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
version = "0.10.0"
weakdeps = ["SpecialFunctions"]
[deps.ColorVectorSpace.extensions]
SpecialFunctionsExt = "SpecialFunctions"
[[deps.Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "Reexport"]
git-tree-sha1 = "362a287c3aa50601b0bc359053d5c2468f0e7ce0"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.12.11"
[[deps.CommonSolve]]
git-tree-sha1 = "0eee5eb66b1cf62cd6ad1b460238e60e4b09400c"
uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
version = "0.2.4"
[[deps.CommonSubexpressions]]
deps = ["MacroTools"]
git-tree-sha1 = "cda2cfaebb4be89c9084adaca7dd7333369715c5"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
version = "0.3.1"
[[deps.CommonWorldInvalidations]]
git-tree-sha1 = "ae52d1c52048455e85a387fbee9be553ec2b68d0"
uuid = "f70d9fcc-98c5-4d4a-abd7-e4cdeebd8ca8"
version = "1.0.0"
[[deps.Compat]]
deps = ["TOML", "UUIDs"]
git-tree-sha1 = "8ae8d32e09f0dcf42a36b90d4e17f5dd2e4c4215"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.16.0"
weakdeps = ["Dates", "LinearAlgebra"]
[deps.Compat.extensions]