Skip to main content

Posts

Showing posts with the label python

Week In Review: TouCans Straight Key, ChatGPT, Tuna Salad Sender, and Halikey

 I started out the week without a straight key for TouCans. By the end of the week, I'd worked with ChatGPT to make the WiFi straight key for TouCans into something pretty cool that worked on both Windows and Chromebook. (Alsthough, Windows is one cool thing ahead at the moment, I'll get to that.) Having decided I wasn't going to be able to get a wired straight key, i took another look at why I'd gone down the wired straight key path. TouCans has had a WiFi sraight key since last year. The issue is that it didn't work with the Chromebook. It was written in Python, and it was a bit more of a chore than I wanted fix it.  Linux on the Chromebook didn't want to provide keyboard access so that a key could be pressed as a straight key.  It also didn't want to provide speaker access, so there was no sidetone. I decided to do an end run and asked ChatGPT to translate the Python version of the WiFi straight key to JavaScript. ChatGPT pulled off the task so perfectly ...

More Coding with ChatGPT: Miscopied CW Ham Radio Callsigns

I've been recording more of my POTA and SOTA activation, and then experimenting with how to  publish the results as well as exploring what information I can derive from the recordings post-activation. One thing I'm findin out is that—of course—my CW copy isn't perfect. Searching through the entire recording of an activation is a bit much for me at the moment, so I lighted on a middle ground technique: determine whether or not the QSOs were with POTA registered users, and if not, investigate those portions of the recording I was fairly certain that ChatGPT could help with this coding task. I was right. The entire coding session took 14 minutes from start to finish. I told ChatGPT about the undocumented REST API presented by pota.app  , gave it an example, and asked it to write a Python script for me that would accept a callsign through the Linux input pipe and then tell me either all the info for the callsign, or print that the callsign wasn't found. Out dropped a script...

Things I Learned: OpenAI To Create CSS, HTML, and JavaScript for a YouTube QSO Video Deck

  I used ChatGPT to crank out a new blog feature: a slide deck that shows all the QSO videos from an activation.  Before I get started, allow me to admit that I just found out that YouTube provides code to embed a playlist on an html page. I didn't know this when I started this project, and frankly, I'm kinda happy about that. If I found an embedded playlist, it would not have been obvious to me that there was more than one video. I would have missd all the others. An example of the resulting video deck can be seen on the field report from my latest POTA activation. I asked ChatGPT to create the CSS and HTML for a video deck presented on a statically served HTML page. It got really close on the first attempt. I only had to refince the code a bit to get exactly what I wanted. The AI even dumped out JavaScript code I hadn't remembered to ask for to control the deck. Later I realized that adding video links one at a time to my blog page was a bit tiresome. I asked the AI to w...

POTA has an REST API!

 And that'll be my submission for the year's most acronyms in a title award (MAIAT.) On the Ham Radio Work Bench discord, NK8O mentioned this following spiffy looking Python script for tracking the parks near you that you haven't activated yet. The creator of the script is Ian Renton, MØTRT. He has other cool looking stuff !

Digging Through NetCDF4 Data Using Google Gemini AI

 I wanted to take a look at the ionosphere over North America late last week, and that meant I needed to explore ionospheric readings via radio occultation from the satellite constelations launched by Spire and PlanetIQ. Spoiler: I haven't been able to get ionospheric data from either constellation yet, but that's a data publishing issue, not a data file structure issue. Exploring the availabel data was a bit clunky at first to say the least. Then, it occurred to me that I could probably ask an AI to write Python code to pull out the strucutre of each netCDF file somewhat automatically. Sure enough, the Google Gemini search enginee version gave me an immediate answer I modified the code just a bit per my personal taste. The complete code can be seen here . From there, with only the filename, I could get output like Where to get the data I was having the best luck with PlanetIQ data as published by UCAR at  https://data.cosmic.ucar.edu/gnss-ro/planetiq/noaa/nrt/level2/2024/ How...

Unschooling and Python || wget, tar -xvzf and for loops

 Last night was a shorter run at things in general because KO6BTY, (the 13 year old known as Diaze here), and I got a later start. We spent what felt like forever, but what was actually only 12 minutes trying to share files from the 'usual' file side of the kid's Chromebook with the Linux side using file folders and whatnot. Nothing worked. For whatever reason, the Linux folders weren't visible in the machine's 'My Files' app. Sharing folders led to the machine basically hanging. Then! Then, we handled the issue like a couple of programmers, and instead of downloading in one system and trying to copy to anther, Diaze just ran the following from her Linux terminal wget https://data.cosmic.ucar.edu/gnss-ro/cosmic2/provisional/spaceWeather/level2/2024/203/ionPrf_prov1_2024_203.tar.gz That was snazzy! It just brought the file right in because, well, command line interface tools are just... snazzy.  Having a chat record of our work together is also really helpful...

Unschooling and Learning Python

 KO6BTY and I are making another run through Python. Diaze has learned a bit of Python in the past when she set up our QSO mapping app to pull in pertinent ionosonde data from the Digisonde ionosondes. Now, we're working with Python again to analyze data not from ground-bound ionosondes, but from the COSMIC2 constellation of satellits that provide ionospheric data includihng electron density profiles. That was the intro, and the application, but this post is more about how to informallly teach Python. What will work, and what won't? With unschooling, a lot of learning is initiated by something called strewing . Strewing as it's comonly defiined is, essentially, keeping things a little cluttered around the house. It's leaving reading material, projects, web sites, and so on, out where everyone in the house, including and especially the kids, can see them. I've widened the definition to include our entire indoor and outdoor lives, and the city and world at large . For...

Things I Learned: Pytest and Python git Installs on Windows

 All of the Datasette plugins and enrichments contain this development instruction towards the bottom of their documentation page: Now install the dependencies and test dependencies: pip install -e '.[test]' However, on windows, the above pip install line does not work. It returns an error message: ERROR: '.[test]' Note that the single quotes are still in the message. That is in fact the issue. This command: pip install -e .[test] Does work on Windows. I've updated the documentation on the datasette-enrichments-gmap-geocode package to reflect this.

Things I Learned: Using Datasette with csvs-to-sqlite on Windows!

 I finally got csvs-to-sqlite to work on the Windows machine here! You might remember that the 12, 10, and 8 year-old gang and I had been unable to coerce the utility into working. That was OK because with our workarounds, we could use it on Github Codespaces, so we were still up and running an instance of Datasette that served our ham radio QSOs. It was also really ok, because with the experience we gained, when one of the gang saw a OneSchema hiring banner hanging in a window overlooking the alley where our favorite pub is located, they immediately knew what the company did, and made sure to point it to me. This led to us checking out their website, and discussing even more of the vagaries of csv files and jobs in the tech industry over our lunch. Unschooling works! Today, I found a way! First, I re-read my original post . I changed our pandas install back to 1.5.0 as the post instructs. I got further. The utility errored out because it was upset about the number of columns na...

F2 Skip Maps: a Project TouCans Side Project

 Diaze (the 12 year old kid here) and I are adding F2 skip paths to the QSO maps from Project TouCans. One point of the project is to give us us an opportunity for Diaze to learn Python. Another point is to better visualize what the radio is doing with real-time data—within a 7 minute window—about the F2 layer! I'll talk more about unschooling and learning Python in another post, for now, here are some of the results we're seeing! Yesterday I made a single QSO to VE7ZD in Canada. I mapped out all the reverse beacon network spots for KD0FNR as well as the QSO using our  new code additions . I can see that the radio did it's usual thing of hitting the stations in the Bay area first. Stanford led the way The map immediately brings up a good question. What do we do for ground wave comms? Another good question is, are they always ground wave, or are some of them veritical incidence skywave? I believe Stanford is mostly ground wave because moving the antenna a bit in the backyar...

The Morning of Hitting the Zone with Datasette

I'm starting to be handy enough with Datasette that I can quickly get answers to my questions! This morning, the question is whether or not the Tuna Topper amplifier combined with the Rockmite is giving better propagation results than the we get with the Rockmite running alone. Since we have a database of all the QSOs and RBN spots of the Rockmite, this is exactly the kind of question Datasette can answer. Here are the commands to run datasette to get an sqlite database from the Rockmite's RBN and QSO data table . I'm listing the commands here because I've been to lazy to simply write a script, and thus far I haven't been able to get the whole assmeblelage to work on Windows, meaning I'm working on a github codespace. Codespaces are super-cool, but also—at least for me... so far—completely unable to keep command history around between launches python -m pip install csvs-to-sqlite python -m pip install pandas==1.5.0  csvs-to-sqlite -dt timestamp rm_rnb_history...

Things I Learned: Modifying installed Python Packages

While the gang and I were using the Datasette csvs-to-sqlite plugin, we learned something about modifying the code of installed Python packages: how to use pip uninstall to find the package. We knew we had issues , and we had begun to figure out how to fix them. What we couldn't figure out is where the actual code we needed to modify lived. We'd used pip to install the plugin, so finally I decided to re-install the plugin, and then watch the installation messages as they flashed by hoping to capture the pertinent directory So, I typed pip uninstall csvs-to-sqlite . pip immediately asked me if I really wanted to uninstall the package at the packages location. Problem solved! The kids and I found the code at that location, made our edits, and tried out our newly modified version of the plugin! References: csvs-to-sqlite plugin

ChatGPT helped us rescue Pennelope, or How to Use Python over Telnet to Filter Ham Radio CQs over the RBN

I used ChatGPT to code a ham radio reverse beacon network filter for the Rockmite using telnet and Python this morning. It was my first really productive coding session with ChatGPT , and I loved it. Maybe the most fun part of it for me is that I get to make up stories as I code: And then, after I'd introduced Penelope, I got to explain her and, more to the point, my plight. ChatGPT proceeded to dump out very useful code that put me and the 12 year-old here who's learning to code in Python on our way. Later, we needed help sending in commands to the telnet server, so I asked ChatGPT what Penelope would do: There was a little confusion about how to get the exception handling to close the program on Ctrl+C just right, so I asked ChatGPT for more help: A few hours later, after we got home from the coffee shop, the kid and I had a script up and running: I'll tell you more about it in another post, but you can look at it here .

Things I Learned: Datasette and links

I spent a little time getting links to work in Datasette. Initially I overthough the problem, imagining that I needed to actual construct the html <a> tag for a link to get it to work in the Datasette table interface. I used the tip on appending text to SQL query results at StackOverflow to create html hyplerlink tags. This decidedly did not work, not becaue the tip was bad, but because Datasette will automatically link a web address without the need for link tags. In the end, the more simple query: select id, question, class, subelement, group_index, group_number, answer, answer_a, answer_b, answer_c, answer_d, "https://hamdaise.wl.r.appspot.com/" || help_link AS help_link from ham_qs where "subelement" = :p0 order by group_index limit 101 worked like a champ. Want links to open in new tabs? There's a plugin for that.

Technician Class Ham Radio Question Pool in Datasette

The 12 year-old here, aka Daize in these pages, and I have been teaching ourselves Datasette, a Python based tool for exploring data sets. We came across the tool the first time as members of the San Francisco Microscopical Society when we attended a meeting about their historical papers database. Datasette , a tool created by Simon Willison is being used to serve their historical document database . It looked like a nice tool to know, but I didn't have an immediate use for it until last week when I got a little bit of bandwidth to setup new help page links for the ham radio practice exam app . I rooted around in the Google App Engine dataset pages a bit, then I played with making pages as templates in the Django based app, (did I mention that Simon was also one of the creators of Django?), and then it occurred to me that Datasette might be the most useful way of inspecting and modifying the help page links. In any event, the kid and I would be learning something new. The short ve...

Things I Learned: Updating Google App Engine Apps

Back in January, I started to simplify the free ham radio practice exams so they'd be easier for the gang—two of whom are learning to program—and I to update in the future. It. Was. Hard. I fought and fought and finally located the Google App Engine debug console where I could change a file at a time, (and actually see a listing of files.) That console has since been deprecated and dropped, (unbeknownst to me.) Consequently, when 12 year-old Daize and I tried to add a simple fix to a misformatted question this morning… Nope! Oh well. I went through the 7 stages of grieving, but really fast this time, and then went to look for Google App Engine deployment too for Python . Fortunately, it still exists! Now it’s called the Google Cloud CLI . Installation was actually straightforward, and since I stored the entire applciation in github including the app.yaml file, deployment was pretty easy as well. We're back up and running! Refererces Free ham radio exam practice app

Today I Learned: pytest output

 Getting pytest to display output, even if the test case passes; sorting tuples by datetime Frequently, I find myself needing to watch print statements during development as pytest calls new methods. Today I learned how to force passing tests to write to the screen. The -rP option is the answer to that. I'm constantly impressed with how much pytest just already has implemented. Along the vein of 'wow, it just works', I was surprised to find how easy it was to sort tuples by date . On a side note, the StackOverflow question linked to in the previous sentence closed as a duplicate, and I don't think it should have been. I mean sure, there was a more general question that could be construed to be the answer if you already knew lots of Python, but that's kind of beside the point I think. If I knew enough python to make the construction, I probably wouldn't have asked the question . I mean I didn't ask that actual question, but you get the idea.

New spot and log mapper features: Transparent RBN and Color Coded Signal Strength

It was difficult to tell the paths from KD0FNR's 20 meter Rockmite to Reverse Beaccon Network spotting stations, and actual QSOs. I started by labeling the paths, and then took a final step to make the spotting paths transparent and immediately evident. The first new set of features includes adding descriptive labels to each path including the callsign of the receiving station as well as the time and date the call was received. The labels appear when the path is clicked. If you'd like to try any of these features out, you can load the kml map at  https://drive.google.com/file/d/1dNkpzdjHaQqMRrulhPYHprZb9OJHbSup/view?usp=sharing into Google Earth on the web. I also wanted a way to determine the relative strength of signals at a glance. I developed a color coding scheme for the paths based on ROYGBIV with brown added in a 0 for 'unknown'. The color coding is  Color S value Brown 1 or uknown Red 2 Orange 3 Yellow 4 Green 5 Blue 6 Indigo 7 Vi...